-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathInput.java
More file actions
34 lines (25 loc) · 865 Bytes
/
Input.java
File metadata and controls
34 lines (25 loc) · 865 Bytes
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
package src;
import java.util.Scanner;
public class Input {
public static void main(String[] args){
System.out.println("Learning Input");
Scanner scanner = new Scanner(System.in);
System.out.print("Enter Your Name: ");
String name = scanner.nextLine();
System.out.print("Enter Your Age: ");
int age = scanner.nextInt();
System.out.print("Enter CGPA: ");
double cgpa = scanner.nextDouble();
System.out.println("Are you a student? (true/false)");
boolean isStudent = scanner.nextBoolean();
if(isStudent){
System.out.println("You are enrolled");
}
else{
System.out.println("Not enrolled");
}
System.out.println("Hello " + name + " Age: " + age + " with Cgpa: " + cgpa);
scanner.close();
}
}
// 42:31