Hi!
Do you hate it, that anybody can come, and read what you have written? Well, today I will show you a simple way, to make a scrambler! I have not worked out, how to make a de-scramler, but we will survive! Here is the CODE:
/*
* Made by pepluser
* pepluser.blogspot.com
*
*/
package testgui;
import java.util.Scanner;
/**
*
* @author Peter
*/
public class Testgui {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
char c1, c2, c3, c4;
System.out.print("Enter word to scramble: ");
c1 = sc.findInLine(".").charAt(0);
c2 = sc.findInLine(".").charAt(0);
c3 = sc.findInLine(".").charAt(0);
c4 = sc.findInLine(".").charAt(0);
System.out.println(c3 + " " + c1 + " " + c4 + " " + c2);
}
}
Well, it should work, i hope you have fun, and you can modify it, and add stuff! See You! :)
pepluser
Friday, March 9, 2012
Randomising :)
Hi!
One of the things I like most in Java, is Random. I like it because I can make it do anything! Here is the code of a basic randomizer! CODE:
import java.util.Random; // imports the Random number generator
class randomizer {
public static void main(String args[]) {
Random rn = new Randon();
int random;
random = rn.nextInt(10); // tells the compiler, in what range of number shoud it generate.
System.out.println(random); // displays the number
}
}
This is a simple code. But you can use the if , to make it more enchanced!
One of the things I like most in Java, is Random. I like it because I can make it do anything! Here is the code of a basic randomizer! CODE:
import java.util.Random; // imports the Random number generator
class randomizer {
public static void main(String args[]) {
Random rn = new Randon();
int random;
random = rn.nextInt(10); // tells the compiler, in what range of number shoud it generate.
System.out.println(random); // displays the number
}
}
This is a simple code. But you can use the if , to make it more enchanced!
Whats WRONG?!
Hi!
I have been working on this question for a few days now. I don`t know whats wrong in my code! I have scanned the internet and on every site, the code is the same, as in what I have made! I need help! You can tell me in the comments, or you can go to Yahoo Answers, and answer it there! Thanks for your help! And here is the code:
/*
* Made by pepluser.
* pepluser.blogspot.com
*/
package test2;
import javax.swing.*;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
/**
*
* @author Peter
*/
public class Test2 implements ActionListener {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
ActionListener a = null;
JFrame f1;
JButton button;
f1 = new JFrame("Test2");
button = new JButton("Hello");
button.addActionListener(a);
f1.add(button);
f1.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
f1.setVisible(true);
}
public void actionPerformed(ActionEvent a) {
button.setText("Goodbye");
}
}
I made this in NetBeanes, a free java IDE! Thanks for your help!
I have been working on this question for a few days now. I don`t know whats wrong in my code! I have scanned the internet and on every site, the code is the same, as in what I have made! I need help! You can tell me in the comments, or you can go to Yahoo Answers, and answer it there! Thanks for your help! And here is the code:
/*
* Made by pepluser.
* pepluser.blogspot.com
*/
package test2;
import javax.swing.*;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
/**
*
* @author Peter
*/
public class Test2 implements ActionListener {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
ActionListener a = null;
JFrame f1;
JButton button;
f1 = new JFrame("Test2");
button = new JButton("Hello");
button.addActionListener(a);
f1.add(button);
f1.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
f1.setVisible(true);
}
public void actionPerformed(ActionEvent a) {
button.setText("Goodbye");
}
}
I made this in NetBeanes, a free java IDE! Thanks for your help!
Subscribe to:
Posts (Atom)