![]() ![]() The only solution to errors is to terminate the execution. Hanumanthu reddy 12 December 2016 at 21:47ġ) Recovering from Error is not possible. Is it necessary that each try block to be followed by catch block ? IOException, SQLException, FileNotFoundException etc.ĪrithmeticException, NullPointerException, ArrayIndexOutOfBoundsException, NumberNotFoundException etc. Un-checked Exception are checked at run timeįor checked Exception Extend Throwable class except RuntimeException.įor un-checked Exception extend RuntimeException. When we write throws keyword as a part of method heading, it is optional to the java programmer to write throw keyword as a part of method body.ĭifference between checked Exception and un-checked Exception ?Ĭhecked Exception are checked at compile time When we use throw keyword as a part of method body, it is mandatory to the java programmer to write throws keyword as a part of method heading The place of using throws is a keyword is always as a part of method heading The place of using throw keyword is always as a part of method body. Throws is a keyword which gives an indication to the specific method to place the common exception methods as a part of try and catch block for generating user friendly error messages Throw is a keyword used for hitting and generating the exception which are occurring as a part of method body It is never thrown in floating-point operations. The ArithmeticException is thrown when integer is divided by zero or taking the remainder of a number by zero. We can not override the method of String and StringBuffer.ĭifference between StringBuffer and StringBuilder.so that they never participates in inheritance that is is-A relationship is not possible but they can always participates in As-A and Uses-A relationship. Both of them are belongs to public final.What is Similarities between String and StringBuffer If content is not fixed and keep on changing and thread safety is not required then we use StringBuilder.If content is not fixed and keep on changing but thread safety is required then we use StringBuffer.If the content is fixed and would not change frequently then we use String.When we use String, StringBuffer and StringBuilder When we create an object of StringBuffer class by default we get 16 additional character memory space. When we create an object of String class by default no additional character memory space is created. The data which enclosed within double quote (" ") is not by default treated as StringBuffer class ![]() ![]() The data which enclosed within double quote (" ") is by default treated as String class. = Operator is always used for comparing references of both source and destination objects but not their contents. ![]()
0 Comments
Leave a Reply. |