Friday, 7 November 2014

JAVA BASIC INTERVIEW QUESTIONS


  • What is a pointer and pointers are used in  Java or not?

Pointer is a reference handle to a memory location. Improper handling of pointers leads to memory leaks and reliability issues hence Java doesn't support the usage of pointers.



  • What is the difference between a JDK and a JVM?

JDK is Java Development Kit which is for development purpose and it includes execution environment also. But JVM is purely a run time environment and hence you will not be able to compile your source files using a JVM.


  • What are local variables?

Local varaiables are those which are declared within a block of code like methods. Local variables should be initialised before accessing them.


  • What is an abstract class?
We can’t create the instance of an abstract class, because abstract classes are incomplete.Abstract modifier doesn’t supported by interface, Values type and static types.We can declare class as abstract by using abstract keyword in beggining of the class definition.

Abstract class provides similar definition of base class which can be shared by multiple derived classes.Abstract class may define abstract methods by using the abstract keyword before the method definition.Abstract methods have no implementation, only they can be implemented in the derived class.


  • what did you understand by Polymorphism?

When one task is performed by different ways i.e. known as polymorphism. For example: to convense the customer differently, to draw something e.g. shape or rectangle etc.In java, we use method overloading and method overriding to achieve polymorphism.
}


  • what is Inheritance?

When one object acquires all the properties and behaviours of parent object i.e. known as inheritance. It provides code reusability. It is used to achieve runtime polymorphism.

0 comments:

Post a Comment