Please enable JavaScript.
Coggle requires JavaScript to display documents.
Declaring and Initializing variables, Understanding Variable Scope, Java…
Declaring and Initializing variables
declaring and initializing a few variables in the same line
declaring variables of different type same line
naming rules of a variable
Understanding Variable Scope
parameters are local variables
Smaller scope
Larger scope
Instance variable
garbage collection
Class variable
Program ends
Java Statements
Switch
Classes that switch supports
Case statement values
Literals, enum constants or final constants
break statement
using return statement as alternative
Loops
while
do while
for loops
infinte for loop
Optional components
for loop where you increment multiple variables at once
Can only initialize variables of the same type
If-then
If-then else
ternary operator
nested conditions
Understanding Default Initialization of
Variables
Local variable
Scope
Default Value
Can't compile without being used
Smart compiler
Instance Variable
default value
static
Class variable
default value
Default values of different types
Ordering Elements in a Class
Comments anywhere
Package first line
Multiple classes in 1 file
1 public class per file
no public classes in file
name when all classes are private
Destroying objects
Garbage collection
System.gc()
simply suggests
Object eligible for gc when
no references pointing to it
references have gone out of scope
finalize()
won't get called twice
can run 1 or 0 times
heap
Understanding Java Operators
Order of operations of operators
Post-unary operators
Pre-unary operators
Pemdas
Binary operators
Arithmetic operators
Applied to any primitives except boolean and string
Numeric Promotion of binary operators
Automatic promotion to large data type
Promoting discrete data type to floating-point
Smaller data types automatically converted to int
Resulting value will have same data type as promoted operands
Understanding Advanced Flow Control
break statement
continue
Sends execution back to boolean statement of the loop
break
nearest inner loop
Has to be used in loop or switch
Understanding Java Statements
Ternary operator with nested conditions