-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinput.java
More file actions
37 lines (26 loc) · 1.07 KB
/
input.java
File metadata and controls
37 lines (26 loc) · 1.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import java.util.Scanner;
class input {
public static void main(String [] arg ){
Scanner scanner = new Scanner(System.in);
System.out.print("What is your name? ");
String name = scanner.next();
System.out.println("Hi "+name+", What is your age?");
Integer age = scanner.nextInt();
System.out.print("at this very young age "+age+" you shave very big dreems. "+"what is your Goal? ");
scanner.nextLine(); // this help to add \n in the end
String goal = scanner.nextLine();
System.out.println("Good "+goal);
}
}
/**
* Method
nextInt( ) - Takes integer input from the user
nextFloat( ) - Takes floating-type input from the user
nextBoolean( ) - Takes boolean input from the user
nextLine( ) - Takes a line of text (with spaces) as input from the user
next( ) - Takes character input from the user
nextByte( ) - Takes a byte value as input from the user
nextDouble( ) - Takes double-type input from the user
nextShort( ) - Takes short-type input from the user
nextLong( ) - Takes long-type input from the user
*/