Please enable JavaScript.
Coggle requires JavaScript to display documents.
chapters: 2.1 to 2.2.3 (how to declare (can have it eq a val - called…
chapters: 2.1 to 2.2.3
-
how to declare
-
-
can have double a, b = ... ;
-
-
types
int = whole num w/o dec
int types
-
-
short
range –32,768 . . . 32,767 - 2 byte size
-
-
constant variables
to declare use final before its value type - for ex a constant var would look like: final double NUM_OF_TOYS = 8;
to follow java style rules put the name of the var in all caps with underscores when needed - this helps distinguish them from normal vars
a constant variable's value can NEVER change - so is cannot be assigned a new value later in the program
char
character type, String type
-
things to know
-
comments
-
for one line comments put // before the explanation - for comments greater than one line, enclose it between / and /
-
-
-
common errors
-
-
do not use magic numbers
do not use a random value, declare it as a final variable with a descriptive name
math
an expression is a combo of vars, numbers, operators, and/or methods
-
-
-