This week's book giveaway is in the Design forum.
We're giving away four copies of Building Microservices and have Sam Newman on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Doubt with String Methods Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Building Microservices this week in the Design forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Doubt with String Methods" Watch "Doubt with String Methods" New topic

Doubt with String Methods

anmita payal

Joined: Jun 22, 2007
Posts: 23
I am not able to understand the clear difference between xxxValue(),ParseXxx() and valueOf() methods. Any one can explain me these with simple example?
dolly shah
Ranch Hand

Joined: Jun 18, 2007
Posts: 383
Do you have K & B for (java-5) book? If you have read page-230 & 231 care fully. You will clear.

SCJP-1.5<br />SCWCD-1.4
Tony Smith
Ranch Hand

Joined: Jul 07, 2007
Posts: 229
To use the first one xxxValue() method you need to have an object created already. For example:

Integer i = new Integer(15);

it will print out the int, byte, double primitive values of the Integer object i.

The following two: parseXxx() and valueOf() are static methods. So that means you can call them by using Integer.parseXxx() or Integer.valueOf().

And the difference betweent the two is that parseXxx() returns primitive but valueOf()returns object. They generally takes String as input. For example:

int a = Integer.parseInt("15");

Integer b = Integer.valueOf("15");
anmita payal

Joined: Jun 22, 2007
Posts: 23
Thanks Tony Smith for explaining .
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link:
subject: Doubt with String Methods
It's not a secret anymore!