File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Passing value to the wrapper class Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Passing value to the wrapper class" Watch "Passing value to the wrapper class" New topic
Author

Passing value to the wrapper class

Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
hi all!!
i want to pass to the Long constructor a value. Accordingto the Certification book u have to pass the value as a string. When i do the following, both work.
Long l = new Long("456");
Long l = new Long(456);
The second version u are not passing within qoutes "". But it still works. Can any1 give explanation!!!
maala
Surya B
Ranch Hand

Joined: May 10, 2000
Posts: 98
From API:
The class Long has two constructors:
Long(long value)
Long(String s)
I think this itself answers your question.
Surya
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
thanks surya
the reason for posting the question was that one of the mock exam
gave wrong answers.
maala
Ajith Kallambella
Sheriff

Joined: Mar 17, 2000
Posts: 5782
Maala,
If you remember which one, go ahead and post it in the Errata so that others don't get misled.
Thanks!
Ajith


Open Group Certified Distinguished IT Architect. Open Group Certified Master IT Architect. Sun Certified Architect (SCEA).
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Passing value to the wrapper class