Advertisement
193030

01. System.out and scanner

Mar 5th, 2021
91
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None
  1. import java.util.Scanner;
  2. public class Main {
  3.  
  4. public static void main(String[] args) {
  5. Scanner scanner = new Scanner(System.in);
  6. System.out.println("What is your name ");
  7. String name = scanner.nextLine();
  8. System.out.println("How old are you " );
  9. int age = scanner.nextInt();
  10. scanner.nextLine();
  11. System.out.println("Tell me your goals ");
  12. String goals = scanner.nextLine();
  13.  
  14. System.out.print("Hello " + name);
  15. System.out.println("You are "+age+ " years old ");
  16. System.out.println("Your goals are " +goals);
  17.  
  18.  
  19. }
  20.  
  21. }
  22.  
Advertisement
RAW Paste Data Copied
Advertisement