添加corejava第11版源码
日期:2019-5-22
This commit is contained in:
1 parent
e199db7c36
commit
af9d779c86
525 files changed
+91425
No files matched your search
@@ -0,0 +1,25 @@
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* This program demonstrates console input.
|
||||
* @version 1.10 2004-02-10
|
||||
* @author Cay Horstmann
|
||||
*/
|
||||
public class InputTest
|
||||
{
|
||||
public static void main(String[] args)
|
||||
{
|
||||
Scanner in = new Scanner(System.in);
|
||||
|
||||
// get first input
|
||||
System.out.print("What is your name? ");
|
||||
String name = in.nextLine();
|
||||
|
||||
// get second input
|
||||
System.out.print("How old are you? ");
|
||||
int age = in.nextInt();
|
||||
|
||||
// display output on console
|
||||
System.out.println("Hello, " + name + ". Next year, you'll be " + (age + 1));
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user