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   SiteMap shows list of All Categories in this site.
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
waht happens when a return type ,even void is specified for 
a constructor?
 Question Submitted By :: Saisagar
I also faced this Question!!     Rank Answer Posted By  
 
  Re: waht happens when a return type ,even void is specified for a constructor?
Answer
# 1
Nothing to be happen
the program might compile the output wont come.
 
Is This Answer Correct ?    1 Yes 0 No
Rajesh
 
  Re: waht happens when a return type ,even void is specified for a constructor?
Answer
# 2
The constructor has the same name as that of the class to 
which it belongs to. When a return type or void is 
specified,no error occurs.It will be considered as a method.
for example:
public class myclass
{
public myclass()
...
}this is considered as a contrustor
whereas,
public class myclass
{
public void myclass()
{
...
}will be considered as a method.....
 
Is This Answer Correct ?    2 Yes 0 No
Chandra Rekha
 
 
 
  Re: waht happens when a return type ,even void is specified for a constructor?
Answer
# 3
You will get a compile time error as , Construcors only 
initialize values  and does not return any thing.
 
Is This Answer Correct ?    0 Yes 0 No
Guest
 
  Re: waht happens when a return type ,even void is specified for a constructor?
Answer
# 4
simply it will considered as a normal method in the class
 
Is This Answer Correct ?    1 Yes 1 No
Ramanareddy333
 
  Re: waht happens when a return type ,even void is specified for a constructor?
Answer
# 5
Answer 3 is wrong
 
Is This Answer Correct ?    0 Yes 0 No
Tntrichy
 
  Re: waht happens when a return type ,even void is specified for a constructor?
Answer
# 6
Answer 3 is absolutely right becuse compiler strictly 
follows the syntax. Except answer 3 all are wrong.
 
Is This Answer Correct ?    0 Yes 0 No
Susheel S
 
  Re: waht happens when a return type ,even void is specified for a constructor?
Answer
# 7
Answer 2 is exactly correcr.I have done practiclly.No 
compile time errors.
Code will run and executes sucessfully.But it treats as 
method not as constructor.
 
Is This Answer Correct ?    0 Yes 0 No
Krishna Kumar G.
 
  Re: waht happens when a return type ,even void is specified for a constructor?
Answer
# 8
*A constructor is a special method which has the same name  
as that of the class which is used for the initialising and 
instance,when it is being created itself.

*Normal method may or may not returns values when a normal 
method does not return value it is mentioned explicitly 
with void keyword

**ANSWER**-- 7 is write
 
Is This Answer Correct ?    0 Yes 0 No
Shankar
 
  Re: waht happens when a return type ,even void is specified for a constructor?
Answer
# 9
runtime exception will be raised
 
Is This Answer Correct ?    0 Yes 1 No
Ravikiran
 

 
 
 
Other Core Java Interview Questions
 
  Question Asked @ Answers
 
what is struts-config-xml?and its use?  3
What is the format of Inner Class after it compiled?  1
Name the methods in mouse listeners ?  3
What is the % operator?  2
what is bytecode ?explain in detail and watz the difference between bytecode and machine code? Lucent2
What is dynamic binding?  2
how session will be expired ? Satyam1
how many design pattern r there? and wht design pattern u use and why ? HP4
What is stop(), suspend(), resume() method?  3
What is a method ?  2
jdbc drivers? Wipro7
what is a thread? IBM8
I want to know the host name and provider name for tcs web mail TCS1
what is the difference between the "protected and default" modifiers?  4
when we write class.forName("any one class"); what happens actually?what it will return?explain stepwise?  3
What is audio clip interface? Name few methods of it ?  1
what is the difference between AWT and SWING what is the advantage of using swing?  2
What is light weight component?  3
can we add two numbers without using arthematic operators? if possible how?  1
What is protected and friendly?  1
 
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