03-02-2012, 04:16 PM
Core Java Interview Questions
01. What is Method Overloading?
Method Overloading is the process of creating a new method with the same name and different signature.
02. What is Encapsulation?
03. What is Constructor?
A constructor is a special method whose task is to initialize the object of its class.
It is special because its name is the same as the class name.
They do not have return types, not even void and therefore they cannot return values.
They cannot be inherited, though a derived class can call the base class constructor.
Constructor is invoked whenever an object of its associated class is created.
04. What is diamond problem?
The diamond problem is an ambiguity that can occur
when a class inherits from two classes that both
descend from a common super class
05. What is Inheritance?
Inheritance is the process by which one object acquires the properties of another object.
A class that is inherited is called a superclass.
The class that does the inheriting is called a subclass.
06. What are static methods?
Methods declared with the keyword static as modifier are called static methods or class methods.
They are so called because they affect a class as a whole, not a particular instance of the class. Static methods are always invoked without reference to a particular instance of a class.
Note: The use of a static method suffers from the following restrictions:
* A static method can only call other static methods.
* A static method must only access static data.
* A static method cannot reference to the current object using keywords super or this.