-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdataTypes.java
More file actions
24 lines (18 loc) · 790 Bytes
/
Copy pathdataTypes.java
File metadata and controls
24 lines (18 loc) · 790 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
import java.util.Scanner;
public class dataTypes {
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
System.out.println("Enter a string: ");
String str = sc.nextLine();
System.out.println("Enter a number: ");
int num = sc.nextInt();
System.out.println("Enter a decimal number: ");
double decimalNum = sc.nextFloat();
System.out.println("Enter a boolean value (true/false): ");
boolean boolValue = sc.nextBoolean();
System.out.println("You entered the string: " + str);
System.out.println("You entered the number: " + num);
System.out.println("You entered the decimal number: " + decimalNum);
System.out.println("You entered the boolean value: " + boolValue);
}
}