Java revise

1) Scanner scan = new Scanner(System.in);
scan.close(); –> close the stream opened

2) difference between Stringbuffer and Stringbuilder

3) find duplicate elements in an array.

4) Solving tower of Hanoi problem using an algorithm

 

 

Eclipse useful shortcuts ===>

Ctrl + Shift + T  ==> Open Type in Hierarchy

Ctrl + Shift + U  ==> Find occurrences of expression in current file

Ctrl + Alt + H     ==> Open Call Hierarchy

Ctrl + Shift + R  ==> Open Resource (file, folder or project)

Advertisements

HashSet

  1. There’s no need to call equals if hashCode differs
  2. There’s no need to call hashCode if (obj1 == obj2)
  3. There’s no need for hashCode and/or equals just to iterate – you’re not comparing objects
  4. When needed to distinguish in between objects.