Exer04.java 785 B

1234567891011121314151617181920212223242526272829303132333435
  1. import java.util.*;
  2. class Exer04
  3. {
  4. public static void main(String[] args)
  5. {
  6. /*
  7. Exer03
  8. 请输入你的网名、你的年龄、你的体重、你是否单身、你的性别等情况。
  9. next() . nextInt(). nextDouble(). nextBoolean(). next()
  10. */
  11. Scanner sc = new Scanner(System.in);
  12. System.out.println("网名");
  13. String name = sc.next();
  14. System.out.println("网名"+name);
  15. System.out.println("年龄");
  16. int age = sc.nextInt();
  17. System.out.println("年龄"+age);
  18. System.out.println("体重");
  19. double weight = sc.nextDouble();
  20. System.out.println("体重"+weight);
  21. System.out.println("单身");
  22. boolean flag = sc.nextBoolean();
  23. System.out.println("单身"+flag);
  24. System.out.println("性别");
  25. char gender = sc.next().charAt(0); //abc charAt(0) a
  26. System.out.println("性别"+gender);
  27. }
  28. }