Elementry Doubt

Hi Can u pl help me .Long x = new Long("42");Long y = new Long(42);What is the difference between these two.
[234 byte] By [rajpuniaa] at [2007-10-3 2:50:40]
# 1

> Hi

> Can u pl help me .

> code]

> Long x = new Long("42");

> Long y = new Long(42);[/code]

> What is the difference between these two.

The first one takes String as a argument to the constructor, second one takes Long as an argument( although its int , but Long is broader so its ok)

Both of them retuen Long type object . Please refer documentation.

prabhmeeta at 2007-7-14 20:39:31 > top of Java-index,Java Essentials,Java Programming...
# 2
And in particular, the string version can throw a NumberFormatException.
JohnKeltya at 2007-7-14 20:39:31 > top of Java-index,Java Essentials,Java Programming...