please tell me the reason for the error.

new Double("25D"); // Ok
new Long("25L"); // Error

Recommended Answers

All 2 Replies

Neither of these lines gives an error for me (current JDK version / Eclipse).
However, if you want to specify a value for these types, using a String rather than a numeric literal seems a little odd.

Yes, I echo the above post, remove the double quotes - you are using String literals instead of a numeric values.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.