What is constructor ?,Java, C ,C++, ASP, ASP.net C# ,Struts ,Questions & Answer, Struts2, Ajax, Hibernate, Swing ,JSP , Servlet, J2EE ,Core Java ,Stping, VC++, HTML, DHTML, JAVASCRIPT, VB ,CSS, interview ,questions, and answers, for,experienced, and fresher
What is constructor ?

Constructors are the special member functions which have 
the same name as the class name. The most important 
thing is that they don\'t hava return type. Constructors 
may be overloaded. If you don\'t provide a constructor 
for the class, the compiler will supply the defualt one. 
Constructors can have any of the access modifiers.

Example:

public class MyClass{
int i;
int j;
public MyClass(){}
protected MyClass(int i){}
private MyClass(int i,int j){}
}

Constructors are the special member functions which have 
the same name as the class name. The most important 
thing is that they don\'t hava return type. Constructors 
may be overloaded. If you don\'t provide a constructor 
for the class, the compiler will supply the defualt one. 
Constructors can have any of the access modifiers.

Example:

public class MyClass{
int i;
int j;
public MyClass(){}
protected MyClass(int i){}
private MyClass(int i,int j){}
}

More interview questions and answers
What are the methods in Applet ?
When is init(), start() called ?
What is Exception ?
What are the ways you can handle exception ?
What is finally method in Exceptions ?
What are the types of access modifiers ?
What are the other modifiers in java ?
Is synchronized modifier ?
What is meant by polymorphism ?
What is inheritance ?
What is method Overloading ?
What is method Overriding ?
Does java support multi dimensional arrays ?
Is multiple inheritance used in Java ?
Is there any tool in java that can create reports ?
What is meant by Java ?
What is meant by a class ?
What is meant by a method ?
What are the OOPS concepts in Java ?
What is meant by encapsulation ? Explain with an example.
What is meant by inheritance ? Explain with an example.
What is mean by JVM ?
What is meant by identifiers ?
What are the different types of modifiers ?
What are the primitive data types in Java ?
What is mean by a wrapper class ?
What is Garbage collection ?
What is mean by final class, methods and variables ?
What is mean by interface ?
What is the difference between an array and a vector ?
What is singleton class ?
What is constructor ?
What is casting ?
What is the difference between final, finally and finalize ?
What is mean by packages in java?
Name 5 calsses you have used ?
Name 2 classes that can store arbitrary number of objects ?
What is the difference between java.applet.* and java.applet.Applet ?
What is a default package ?
What is anonymous class ?
What is the use of an interface ?
What is a serializable interface ?
How to prevent field from serialization ?
What is the difference between throw and throws ?
Can multiple catch statements be used in exceptions ?
Is it possible to write a try within a try statement ?
What is mean by a Thread ?
What is mean by multi-threading ?
What is the 2 way of creating a thread ? Which is the best way and why?
What is the method to find if a thread is active or not ?
What is the difference between sleep and suspend ?
Can thread become a member of another thread ?
What are the three types of priority ?
Garbage collector thread belongs to which priority ?
What is the use of this ?
How can you find the length and capacity of a string buffer ?
How to compare two strings ?
What is the purpose of run-time class and system class?
What is the method used to clear the buffer ?
What is mean by Stream Tokenizer ?
What is serialization and de-serialisation ?
What is mean by Applet ?
How to find the host from which the Applet has originated ?
What is the life cycle of an Applet ?
How do you load an HTML page from an Applet ?
What is mean by getCodeBase and getDocumentBase method ?
What is the use of parameter tag ?
What is the difference between getAppletInfo and getParameterInfo ?
How to communicate between applet and an applet ?
What is mean by event handling ?
What are all the listeners in java and explain ?
What is mean by an adapter class ?
What are the types of mouse event listeners ?
What are the types of methods in mouse listeners ?
What is the difference between panel and frame ?
What is the default layout of the panel and frame ?
What is the difference between list and choice ?
What are the different types of Layouts ?
What is mean by CardLayout ?
What is the difference between GridLayout and GridBagLayout?
Which class has no duplicate elements ?
What is mean by Swing ?
What is the difference between an applet and a Japplet?
What are all the components used in Swing ?
What is mean by tab pans ?
What is the use of JTree ?
What is the use of JTable ?
What is mean by JFC ?
What is JAR file ?
What is mean by manifest files ?
What is two properties in Beans ?
What is the use of beaninfo ?
What are the interfaces you used in Beans ?
What are the classes you used in Beans ?
What is the difference between C++ & Java ?
What is the difference between Process and Threads ?
How will you initialize an Applet ?
What is the order of method invocation in an Applet ?
When is update method called ?
What is JNI ?