The switch Statement

By Raul Rios

The switch statement has the following form:

[ ] = optional Example:

The 6 things you must remember about the switch statement are: It works with the following data types: byte/Byte, short/Short, int/Integer, char/Character, String and enum All case labels should be compile time constants (literals or final variables) ..Continue Reading

The if Statement

By Raul Rios

The if statement has two forms: if-then and if-then-else. Before taking a look to how these two forms are used, make sure you understand the related terminology: Operators, Variables and Literals can be used in building expressions, which compute to values Expressions are the core components of statements which are ended with ..Continue Reading

5 Java Equality Comparison Subtleties

By Raul Rios

What do you use in Java to check if two things are equal or not? And what’s exactly the meaning of being equal? OK, you already probably know that you can use the operator == to compare primitives and objects. If you’ve read about the equals-hashCode contract you probably also know that you can ..Continue Reading

Java Operators

By Raul Rios

Operator precedence is very important. Why? Because there are questions in the exam where the right answer depends on knowing what operation is done before or after another. Take the following expression where two operators come into play: 4 + 3 % 2 What’s the result of this expression? If ..Continue Reading