-
Notifications
You must be signed in to change notification settings - Fork 14
/
dataType3524.java
19 lines (19 loc) · 1 KB
/
dataType3524.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
public class dataType3524 {
// // Integer data types
// byte byteValue = 127; // Correct
// // byte byteValue = 128; // Incorrect: Value exceeds the valid range (-128 to 127)
// long longValue = 9223372036854775807; // Incorrect, require L at the end
// long longValue = 9223372036854775807L; // Correct
// long longValue = 9223372036854775807; // Incorrect, require L at the end
// long longValue = 9223372036854775808L; // Incorrect: Value exceeds the valid range
// // Floating-point data types
// float floatValue = 3.14f; // Correct
// float floatValue = 3.14; // Incorrect: Floating-point literals need 'f' or 'F' suffix
// // Boolean data type
// double doubleValue = 3.14159; // Correct
// // Character data type
// char charValue = 'A'; // Correct
// char charValue = "A"; // Incorrect: Use single quotes for characters
// boolean booleanValue = true; // Correct
// boolean booleanValue = 0; // Incorrect: Use 'true' or 'false' for boolean values
}