-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path02Variables.java
More file actions
27 lines (24 loc) · 958 Bytes
/
02Variables.java
File metadata and controls
27 lines (24 loc) · 958 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
class Variables {
public static void main(String[] args) {
// Variable declaration and initialization
int myNumber = 10;
String myString = "Hello, World!";
double myDouble = 5.99;
boolean myBoolean = true;
// Printing variables
System.out.println("Integer: ==> " + myNumber);
System.out.println("String: ==> " + myString);
System.out.println("Double: ==> " + myDouble);
System.out.println("Boolean: ==> " + myBoolean);
// Changing variable values
myNumber = 20;
myString = "Goodbye, World!";
myDouble = 10.99;
myBoolean = false;
// Printing updated variables
System.out.println("Updated Integer: ==> " + myNumber);
System.out.println("Updated String: ==> " + myString);
System.out.println("Updated Double: ==> " + myDouble);
System.out.println("Updated Boolean: ==> " + myBoolean);
}
}