Tips for java dummies

  • You can supply variable length params

void example(String...strings) {};


  • Difference between single quotes and double quotes

  1. System.out.print("H" + "a"); System.out.print('H' + 'a'); //returns Ha169.

  • Define, instantiate, and call all at once 

  1. new Object() {
  2. void hi(String in) {
  3. System.out.println(in);
  4. }
  5. }.hi("weird");


No comments:

Post a Comment