Core Java Archive
Runtime polymorphism: It is called Dynamic binding. It is Method overriding technique. Defining a method in the Child class with the same name and same signature of its Parent class. We can implement Method overriding …
Object casting: Conversion of data from one type to another type at runtime is called casting. We have discussed primitive data casting in datatypes concept. Conversion of Object in Parent Child relation is called Object …
Down casting: The concept of collecting Child object address back to Child type reference variable from Parent type. By assigning Child object address into Child type variable, we can access the complete functionality of Parent …
Introduction to Exceptions: In the process of compilation and execution of Java application, chance of getting 3 types of errors (Syntax, Logical and Runtime). Exception is a Runtime Error. Exception is a class. Exception causes …
ArithmeticException: This exception class is belongs to lang package. It occurs when we divide any number with zero value. InputMismatchException: This exception class is belongs the java.util package Scanner class is used to read input …
Exceptions Hierarchy: Java API is providing pre-defined Exception classes and Error classes. Java.lang.Throwable is the super class of all exception classes. Exception and Error are the direct extensions (sub classes) of Throwable. We cannot handle …
Try-Catch: Java API provides 5 keywords to handle exceptions. Keywords are try, catch, finally, throws and throw. try: ‘try’ is a keyword. It is used to define a block. It contains doubtful code that raises …
Handling Exception: Try block contains doubtful code that raises exception. When exception raises, try block throws exception object to catch block. Catch block collects the exception object and handles. If no exception in try block, …
Try with multi catch: One try block can have multiple catch blocks. In try block, we can define number of instructions. Try block can raise more than one exception from its logic. To handle different …
Java Error classes: An Error is a subclass of Throwable. An Error class indicates serious problems that a reasonable application should not try to catch. Most of the errors are abnormal conditions. The java.lang.Errors provides …