Skip to main content

Posts

Showing posts from September 3, 2017

Amazing Facts About java

Exceptions:-    1) One catch with many Exception(I am talking about java 7 special feature) do not allow to keep same type (i.e from same hierarchy ) in one catch with piped symbols. catch (FileNotFoundException | IOException e)  2) It is not mandatory to catch or handle unchecked exception, Following method we can call with try block easily:- public static void doSomething() throws NullPointerException{  }  3) You can not override methods with broader exception , For example super class methods throws FileNotFoundException then your sub class can not override same method changing the exception to IOException. 4) You can not assign values to exception reference if it is multi-catch block , Reason is it is made final by Java giants .   Threads:-  1) Even you make thread to sleep , it is not guaranteed it will start working right after completing the sleep time. It will go in runnable state and whenever it will get time from scheduler will start executing. Scheduler is OS