Professional Documents
Culture Documents
OCA Notes
OCA Notes
OCA Notes
static method can't access non-static variable and non static methods
main method cannot return types. it has to be void. if return is the case, then it
will throw and error at runtime
20.0 is NOT float. float has to have suffix f or cast it as float. Decimal pt
number is double by default
charAt() can take a char value as an argument> Yes, it can because it takes an int
and char will be implicitly promoted to int.
floating point cannot have suffix (d or f) while form of number is aside from
decimal
trim() only removes white space from front and end of string
precedence of / and * is same (and is higher than + and -) and since the expression
is evaluated from left to right
////// A char value can ALWAYS be assigned to an int variable, since the int type
is wider than the char type.///
2. No two of the case constant expressions associated with a switch statement may
have the same value.
3. 3. At most, one default label may be associated with the same switch statement.
(It is valid to not have default label at all.)
long, float, double, and boolean can NEVER BE USED AS A SWITCH variable.
When the return type of the overridden method (i.e. the method in the base/super
class) is a primitive, the return type of the overriding method (i.e. the method in
the sub class) must match the return type of the overridden method.
static meethods cannot be overriden (they are shadowed), same goes for private &
final methods. Abstract methods can be overriden.
a variable in main, can shadow the SAME variable (name) in global variable.