Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int SomeIntegerNumber = 5; // This creates an integer variable called SomeIntegerNumber and assigns it the number 5.
- // Variables of type int when not assigned a value gets a default, in Java would be 0.
- int SomeIntegerNumber2; // This creates an integer variable but doesn't have an initial value and so is assigned 0.
- SomeIntegerNumber2 = 5; // Here the variable SomeIntegerNumber2 is assigned a value of 5 overwriting its value of 0.
- int SomeIntegerNumber3 = 5 + 3; // This creates an integer variable with an operator.
- // The expression will be evaluated, 8 is then assigned to SomeIntegerNumber3.
- String SomeText = "Hello World"; // This creates a String variable and stores the Text "Hello World".
- double Pi = 3.1415926535; // This creates a double variable, which can be used to store numbers with decimal values.
- // The variable is assigned the first few digits of the constant Pi (3.1415926535).
Advertisement
Add Comment
Please, Sign In to add comment