Tag: Core java
Difference between final & finally & finalize keyword? The keyword final is an access modifier, finally is a block and finalize is a method. The keyword final is applicable to the classes, variables and methods of the classes finally is a block associated with the try catch block that is . . . Read more
Explain Default exception handling in Java? Inside a method, if any exception occurs the method in which it is raised is responsible to create exception object by including the following information. Name of exception Description of exception Location at which exception occurs(Stack trace). After creating exception object method handover that . . . Read more
What is Exception and Runtime stack mechanism? An unexpected unwanted even that disturbs normal flow of the program is called an exception. It is highly recommended to handle the exceptions and the main objective of exception handling is graceful termination of the program. Exception Handling doesn’t mean repairing an exception. . . . Read more
Difference between IS-A relationship and Has-A relationship. IS-A Relationship It is known as an inheritance The main advantage of IS-A relationship is code reusability. By using extends keyword we can implement IS-A relationship. Whatever method parent has by-default available to the child and hence on the child reference we can call . . . Read more
What is Encapsulation? The process of binding data and corresponding method into a single unit is nothing but encapsulation. If any component follows Data Hiding and Abstraction such type of component is said to be encapsulated component. Encapsulation = Data hiding + Abstraction. Encapsulation is a principle of wrapping data . . . Read more
What is the use of Abstract modifier in Java An abstract is a modifier applicable to classes and methods but not for variables. Abstract Method Even though we don’t know about implementation still, we can declare a method with abstract modifier i.e. for the abstract method the only declaration . . . Read more
Difference between normal import & static import? Explain import statement and difference between normal import & static import? To access a class or method from another package we need to use the fully qualified name or we can use import statements. The class or method should also be accessible. Accessibility . . . Read more
How many class can be public in Java Program? A JAVA Program can have any number no class but at most one class can be declared as public. If there is public class then the name of the Java program must be same as public class otherwise we will . . . Read more