University stuff.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Metoder.java 434B

1234567891011121314151617181920
  1. import java.util.Scanner;
  2. class Metoder {
  3. private static void converse(Scanner s) {
  4. System.out.println("What's your name?");
  5. String name = s.nextLine();
  6. System.out.println("Where do you live?");
  7. String city = s.nextLine();
  8. System.out.println("Hello, "+name+"! You are from "+city+".");
  9. }
  10. public static void main(String[] args) {
  11. Scanner s = new Scanner(System.in);
  12. converse(s);
  13. converse(s);
  14. converse(s);
  15. }
  16. }