Chapter
Declaration & Assignment
From ComputerScienceOne by Dr Chris Bourke
Concepts
- What primitive types are available in Java?
"Java provides several primitive types. byte is an 8-bit signed 2s complement integer with the wrapper class Byte; short is a 16-bit signed 2s complement integer with the wrapper class Short; int is a
- How are variables declared and assigned in Java?
"Java is a statically typed language meaning that all variables must be declared before you can use them or refer to them. In addition, when declaring a variable, you must specify both its type and it
- What shorthand and read-only options are available for Java variables?
"For brevity, Java allows you to declare a variable and immediately assign it a value on the same line. So these two code blocks could have been more compactly written as:\n\n1 int numUnits = 42;\n\n2