-
Notifications
You must be signed in to change notification settings - Fork 0
/
AllBasicTypesParams.java
41 lines (31 loc) · 1.44 KB
/
AllBasicTypesParams.java
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
38
39
40
41
public class AllBasicTypesParams {
public static void main(String[] args) {
modifyAndPrint(true, (byte)5, (short)10, 'A', 15, 20L, 25.0f, 30.0);
ignoreAllParams(true, (byte)5, (short)10, 'A', 15, 20L, 25.0f, 30.0);
}
public static void modifyAndPrint(boolean boolValue, byte byteValue, short shortValue,
char charValue, int intValue, long longValue,
float floatValue, double doubleValue) {
// Modify and print each value
System.out.println(!boolValue); // Expected: false
byteValue += 1;
System.out.println(byteValue); // Expected: 6
shortValue += 2;
System.out.println(shortValue); // Expected: 12
charValue += 1;
System.out.println(charValue); // Expected: B
intValue += 3;
System.out.println(intValue); // Expected: 18
longValue += 4;
System.out.println(longValue); // Expected: 24
floatValue += 5.0f;
System.out.println(floatValue); // Expected: 30.0
doubleValue += 6.0;
System.out.println(doubleValue); // Expected: 36.0
}
public static void ignoreAllParams(boolean boolValue, byte byteValue, short shortValue,
char charValue, int intValue, long longValue,
float floatValue, double doubleValue) {
// Do nothing
}
}