ALLInterview.com :: Home Page KalAajKal.com
 Advertise your Business Here     
Browse  |   Placement Papers  |   Company  |   Code Snippets  |   Certifications  |   Visa Questions
Post Question  |   Post Answer  |   My Panel  |   Search  |   Articles  |   Topics  |   ERRORS new
   Refer this Site  Refer This Site to Your Friends  Site Map  Bookmark this Site  Set it as your HomePage  Contact Us     Login  |  Sign Up                      
tip   To Refer this Site to Your Friends   Click Here
Google
 
Categories  >>  Software  >>  Core Java  >>  Java J2EE  >>  Java Related
 
 


 

 
 Core Java interview questions  Core Java Interview Questions
 Advanced Java interview questions  Advanced Java Interview Questions
 Swing interview questions  Swing Interview Questions
 EJB interview questions  EJB Interview Questions
 Servlets interview questions  Servlets Interview Questions
 Struts interview questions  Struts Interview Questions
 JDBC interview questions  JDBC Interview Questions
 JMS interview questions  JMS Interview Questions
 SunOne interview questions  SunOne Interview Questions
 J2EE interview questions  J2EE Interview Questions
 Weblogic interview questions  Weblogic Interview Questions
 Websphere interview questions  Websphere Interview Questions
 Java Networking interview questions  Java Networking Interview Questions
 Java J2EE AllOther interview questions  Java J2EE AllOther Interview Questions
Question
why the constructor should be used in class,if there is no 
constructor what will happen?
 Question Submitted By :: Ramanareddy333
I also faced this Question!!     Rank Answer Posted By  
 
  Re: why the constructor should be used in class,if there is no constructor what will happen?
Answer
# 1
In Java,  initialization of every object possible 
by  providing a constructor. If a class has a constructor, 
Java automatically calls that constructor when an object is 
created. So initialization is guaranteed. 

If we don't define a constructor for a class, a default 
parameterless constructor is automatically created by the 
compiler.
 
Is This Answer Correct ?    1 Yes 0 No
Bindhu
 
  Re: why the constructor should be used in class,if there is no constructor what will happen?
Answer
# 2
Hi... Nothing will happen the compilet will supply the 
default constructor of the class.Normally canostructor can 
be used to instantiate an object.
 
Is This Answer Correct ?    0 Yes 0 No
Devarathnam C,kotagudibanda(po
 
 
 
  Re: why the constructor should be used in class,if there is no constructor what will happen?
Answer
# 3
constructor is used to initialize the variables during the 
creation of instances.
If there is no constuctor no object will be gets created.
 
Is This Answer Correct ?    0 Yes 2 No
Ravikiran
 
  Re: why the constructor should be used in class,if there is no constructor what will happen?
Answer
# 4
Constructor is used initialize certian paramameters to each 
object on their creation.We can also overload 
constructors.So we can initialize objects with diff params.
 
Is This Answer Correct ?    0 Yes 0 No
Yamini
 

 
 
 
Other Core Java Interview Questions
 
  Question Asked @ Answers
 
why java does not support multiple inheritance Mind-Tree14
what is marker interface ? what is the necessity of it? Accenture4
Howmany number of objects we can store in an ArrayList. Is there any limit? TCS5
How to create an instance of a class if the class has private constructor?  2
What is audio clip interface? Name few methods of it ?  1
explain the life cycle of thread? CTS5
When we can access the static data member without creating the object what is the need of the object in java. ssinformatics4
How multi processing is achieved in JAVA? BMC4
how many access specifiers are available in java  5
whats string ? HCL8
Same common question what is Map,Set,HashMap,List???? Symphony3
What are the allowed, non-Unicode letter characters that can be used as the first character of an identifier?  2
what is stringtolennizer with example? Symphony1
What is the difference between throw and throws?  5
can we have virtual functions in java? Wipro7
What is casting?  3
Given: 11. public static void main(String[] args) { 12. Integer i = uew Integer(1) + new Integer(2); 13. switch(i) { 14. case 3: System.out.println(”three”); break; 15. default: System.out.println(”other”); break; 16. } 17. } ‘What is the result? 1 three 2 other 3 An exception is thrown at runtime. 4 Compilation fails because of an error on line 12.  2
Can I create any Marker Interface? If yes then how can I use it???  1
what is difference between throw and throws in exception?  16
what is the use of private constructor in core java? Satyam3
 
For more Core Java Interview Questions Click Here 
 
 
 
 
 
   
Copyright Policy  |  Terms of Service  |  Help  |  Site Map 1  |  Articles  |  Site Map  |   Site Map  |  Contact Us interview questions urls   External Links 
   
Copyright © 2007  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  Forum9.com   ::  KalAajKal.com