Posts

Exception Handling In java

Image
Exception Handling in Java Exception: Exceptions are the run-time errors in java . To handle these type of errors we come across the concept of "Exception Handling". Exception will interrupt the flow of control of the program .  Exception can be of three types : Checked Exception  Unchecked Exception Error. Checked Exception: All the compile time exceptions are considered as Checked Exceptions. These classes will extend the Throwable class. Examples :( IO Exception, SQL Exceptions). Un-checked Exception: All the Run time Exceptions are considered as Un Checked Exceptions.  These will extends RunTimeException Class . Examples:(ArithmeticException, ArrayIndexOutOfBoundException). Error: The Exceptions that cant be handled are called as Errors (will not be recovered). Example: (OutOfMemory Error,VirtualMacine Error). Hierarchy Of Exception Handling In Java Cases where the exceptions may raise are as follows : Arithm...

Strictfp keyword in java

Strictfp keyword Sctrictfp :   It is a keyword in java which is used to make a the common precision for floating type which differs from platform to platform . Strictfp can be used at three levels : Class Level Interface Level  Method Level.   Syntax for class Level: strcitfp class <ClassName> {      varibales;            methods(); } Syntax for Interface Level: strictfp interface <interface Name> {      final variables;      abstract methods(); } Syntax for method level: class <class Name> {    variables ;     strictfp <return type> <method name> } Program using Strictfp at class level strictfp class StrictfpClass { float value=10.2f; void add() { value=10+value; System.out.println(value); } } class Strictfp  { publi...