10 Things You Might Not Know About Java

26 August 2017
  1. A block of code (defined by {...}) can be created practically anywhere.

  2. A method may have up to 255 parameters (no this is not a challenge, consider using a parameter object instead).

  3. It is only valid to call this or super in the first line of a constructor.

  4. If a constructor does not use super, a call will be made to the superclass's default constructor with no arguments. The default constructor of an object calls the superclass's constructor as well.

  5. A class can not use a private or protected access modifier.

  6. While a class can only extend one class, an interface can extend multiple interfaces.

  7. Default methods of an interface will be used if the method is not defined in the class implementing the interface.

  8. The default case statement does not need to be the last case in a switch statement. It can in fact be placed first, last or anywhere in the middle.

  9. The + operator is left-associative no matter if it is adding numbers or concatenating strings.

  10. An array can not be initialized with curly brackets on any line other than the one it was declared on.