Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner; //used to track keystrokes
- import javax.swing.JOptionPane;
- public class AsciiArt
- {
- public static void main ( String[] args )
- {
- Scanner keyboard = new Scanner (System.in); //new keyboard
- int num = keyboard.nextInt();
- System.out.println("Enter an integer :: ");
- System.out.println(num);
- //int num = keyboard.nextInt(); keyboard is a reference variable, nextInt is the method call
- // System.out.print("Enter an integer :: "); - prompts the user
- System.out.println("Enter a double :: ");
- double num2 = keyboard.nextDouble(); //PRINTS DOUBLE VARIABLE FROM INPUT
- System.out.println(num2);
- System.out.println("Enter a string :: ");
- String word = keyboard.next(); //Prints string
- System.out.println(word);
- System.out.println("Enter a sentence :: ");
- String sentence = keyboard.nextLine();
- System.out.println(line);
- System.out.println(num + "" +sentence);
- System.out.print(keyboard.nextInt());
- System.out.print(keyboard.nextInt());
- System.out.print(keyboard.nextInt()); // Input - 12345 Output - 123
- BufferedReader keyboard = new Buffered Reader
- new InputSTreamReader (System.in) );
- System.out.print("Enter a word :: ");
- String s = keyboard.readLine(); //readLine() reads in all data as text / string data
- System.out.println(s + '\n');
- //Gui Input Box
- input = JOptionPane.showInputDialog("Enter anm integer :: ");
- one = Integer.parseInt(input);
- //Gui Output Box
- JOptionPane.showMessageDialog(null, "Integer value :: " + one);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement