This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Java Interview Guide and have Anthony DePalma on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes what is the difference??? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "what is the difference???" Watch "what is the difference???" New topic

what is the difference???

malathi latha

Joined: Feb 11, 2001
Posts: 21
Hi all
consider the following code snippets
/*****code snippet1******/

/***end of code snippet1****/

/***code snippet2****/

/***end of code snippet2**/
the first snippet works fine it doesn't complain about the absence of explicit default constructor declaration
but the second code complains!!
please can anyone explain me the difference..
thank you
Manfred Leonhardt
Ranch Hand

Joined: Jan 09, 2001
Posts: 1492
Both fail for me with compile error: Missing default constructor!
Gaurav Mantro
Ranch Hand

Joined: Sep 08, 2000
Posts: 61
Hi Malathi.
Have you compiled the code ? Because according to my understanding both code snippet should fail as mentioned by Manfred.


----------------------<br />regards.<br /><a href="" target="_blank" rel="nofollow">Gaurav Mantro</a><br /><a href="" target="_blank" rel="nofollow">Java Information Portal</a> - <a href="" target="_blank" rel="nofollow"></a>
anil kuchana
Ranch Hand

Joined: Sep 08, 2000
Posts: 404
Hi malathi,
I think u did a mistake in your question itself,
if in code snippet1 if you specify a return type such as void for method test[ in which case it wouldn't be a constructor anymore] then your thinking is right,
if you dont mean it then they both are same snippets.
/***** scjp resources*****///// Home of Java Skills SCJP 5.0, SCBCD, SCEA mock exams
I agree. Here's the link:
subject: what is the difference???
It's not a secret anymore!