Interview Questions on Java - Basics
1. How java differs from other high level languages?
The most importance feature of java is platform independence. i.e, we can write and compile java program in one platform (say windows) and we can execute the generated ".class"(Byte code) file in another platform(say Linux).
2. What are the object-oriented programming concepts?
1. Class
2. Object
3. Inheritance
4. Encapsulation
5. Polymorphism
3. Define Class and Object?
Class: Class is a template or model for an Object.
Object: Object is an instance of Class and physically exist(Memory will be allocated for each Object of Class).
4. What is Inheritance?
Inheritance : The process of acquiring the properties of another class is called Inheritance.
In this Process two types of classes there
1. Base Class or Super Class : The class which gives the properties.
2. Child Class or Dirved Class: The Class which get the the properties.
5. What is Encapsulation?
Encapsulation: It is the packing of data and functions into a single component.We can achieve this by using classes.
6. What is Polymorphism?
The ability to take more than one form is called polymorphism. There are two types polymorphism.
1. Compile time Polymorhism( or Static polymorphism) : It decides at the time of Compile time. ex: Method OverLoading.
2. Runtime Polymorhism( or Dynamic polymorphism): It decides at the time of Running time. ex: Method Overriding.