1.System类
public class chapter3_0 {
public static void main(String[] args) {
System.out.print(System.out);
}
}
System.out.println指向System类的out变量,这个变量是一个提供了方法println的PrintStream
2.Scanner类
public class chapter3_1 {
public static void main(String args[]) {
String line;
Scanner in = new Scanner(System.in);
System.out.print("Type something:");
line = in.nextLine();
System.out.println("You said:" + line);
System.out.print("Type something else:");
line = in.nextLine();
System.out.println("You also said:" + line);
}
}