-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinput.java
More file actions
33 lines (28 loc) · 1013 Bytes
/
Copy pathinput.java
File metadata and controls
33 lines (28 loc) · 1013 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
import java.util.Scanner;
public class input{
public static void main(String[] args){
Scanner sc=new Scanner(System.in);
System.out.print("Enter your name: ");
String name=sc.nextLine();
System.out.print("Enter your age :");
int age=sc.nextInt();
System.out.print("Enter your grade: ");
double grade=sc.nextDouble();
System.out.print("Are you a student (true/false)?: ");
boolean isStudent=sc.nextBoolean();
sc.close();
//printing the things
System.out.println("-=-=-=-=-=-=-=-=-=-=-=-");
System.out.println("-=-=-=-=-=-=-=-=-=-=-=-");
System.out.println("Hello! "+name);
System.out.println("Your age is "+age);
System.out.println("Your grade is "+grade);
if(isStudent){
System.out.println("You are enrolled in the classes");
}
else
{
System.out.println("You are not enrolled in the classes");
}
}
}