Advertisement
RazorBlade57

Notes

Sep 25th, 2016
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.64 KB | None | 0 0
  1. import java.util.Scanner;  //used to track keystrokes
  2.  
  3. import javax.swing.JOptionPane;
  4. public class AsciiArt
  5. {
  6.    public static void main ( String[] args )
  7.    {
  8.    
  9.  
  10.        
  11.        Scanner keyboard = new Scanner (System.in); //new keyboard
  12.        int num = keyboard.nextInt();
  13.        System.out.println("Enter an integer :: ");
  14.        System.out.println(num);
  15.        
  16.        //int num = keyboard.nextInt(); keyboard is a reference variable, nextInt is the method call
  17.        // System.out.print("Enter an integer :: "); - prompts the user
  18.        
  19.        System.out.println("Enter a double :: ");
  20.        double num2 = keyboard.nextDouble(); //PRINTS DOUBLE VARIABLE FROM INPUT
  21.        System.out.println(num2);
  22.        
  23.        System.out.println("Enter a string :: ");
  24.        String word = keyboard.next(); //Prints string
  25.        System.out.println(word);
  26.        
  27.        System.out.println("Enter a sentence :: ");
  28.        String sentence = keyboard.nextLine();
  29.        System.out.println(line);
  30.        
  31.        System.out.println(num + "" +sentence);
  32.        
  33.        System.out.print(keyboard.nextInt());
  34.        System.out.print(keyboard.nextInt());
  35.        System.out.print(keyboard.nextInt()); // Input - 12345            Output - 123
  36.        
  37.        BufferedReader keyboard = new Buffered Reader
  38.                new InputSTreamReader (System.in) );
  39.         System.out.print("Enter a word :: ");
  40.         String s = keyboard.readLine(); //readLine() reads in all data as text / string data
  41.         System.out.println(s + '\n');
  42.                
  43.        
  44.        
  45.        //Gui Input Box
  46.         input = JOptionPane.showInputDialog("Enter anm integer :: ");
  47.         one = Integer.parseInt(input);
  48.        
  49.         //Gui Output Box
  50.         JOptionPane.showMessageDialog(null, "Integer value :: " + one);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement