public static void main(String[] args) throws Exception
{
/*
Scanner cin = new Scanner(System.in);
System.out.println("请输入你的名字:");
String name = cin.nextLine();
System.out.println("你输入你的年龄");
int age = cin.nextInt();
System.out.println("你的名字是:" + name + " " + "你的年龄是:" + age);
*/
Scanner scanner = new Scanner(new FileInputStream("hello.txt"));
String value = "";
while(scanner.hasNext())
{
value += scanner.nextLine();
value += "\n";
}
System.out.println(value);
}
{
/*
Scanner cin = new Scanner(System.in);
System.out.println("请输入你的名字:");
String name = cin.nextLine();
System.out.println("你输入你的年龄");
int age = cin.nextInt();
System.out.println("你的名字是:" + name + " " + "你的年龄是:" + age);
*/
Scanner scanner = new Scanner(new FileInputStream("hello.txt"));
String value = "";
while(scanner.hasNext())
{
value += scanner.nextLine();
value += "\n";
}
System.out.println(value);
}