wood burning stoves 2.0*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Default Constructor Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Default Constructor" Watch "Default Constructor" New topic
Author

Default Constructor

Roger Zhao
Ranch Hand

Joined: Aug 05, 2003
Posts: 73
Hi,all:
Given:
1. public class Test { }
What is the prototype of the default constructor?
A. Test()
B. Test(void)
C. public Test()
D. public Test(void)
E. public void Test()
Which is correct one, A or C?
As I known, default constructor is with the same identifier as the class. So I choose C. Right?
Thanks,
Roger


"There is a will,there is a way!"<br />SCJP1.4
Andres Gonzalez
Ranch Hand

Joined: Nov 27, 2001
Posts: 1561
As I known, default constructor is with the same identifier as the class. So I choose C. Right?
yup.. If you had:
class Test { }
then the answer would've been A
[ September 02, 2003: Message edited by: Andres Gonzalez ]

I'm not going to be a Rock Star. I'm going to be a LEGEND! --Freddie Mercury
K Ville
Ranch Hand

Joined: Aug 16, 2003
Posts: 58
Same here. The default constructor(the one the compiler provides) takes the same identifier as the class'. So, C. public Test(){} is the correct answer. This very knowledge I got from Madame Sierra's book. I'm targetting Oct. 18 as my exam date. God bless!


Thinking is the talking of the soul with itself...-Plato
Roger Zhao
Ranch Hand

Joined: Aug 05, 2003
Posts: 73
Thanks.
V,my Exam is coming this week. God bless you and me!
 
wood burning stoves
 
subject: Default Constructor