Skip to main content



      Home
Home » Newcomers » Newcomers » Double( String ) not working(Unable to convert a double to a string)
Double( String ) not working [message #1823738] Wed, 01 April 2020 02:43 Go to next message
Eclipse UserFriend
The following bog standard code returns the integer conversion but throws an exception in the double line. I have tried all three methods of converting double to string and get the same result each time.
// string to int
String s = "5";
int i = Integer.parseInt(s);
System.out.println("int value = " + i);

// string to float
double d = Double.parseDouble(s);

I've tried to catch the error code to no avail. What I get is this:

Premain$1.transform(ClassLoader, String, Class<?>, ProtectionDomain, byte[]) line: 48
TransformerManager.transform(ClassLoader, String, Class<?>, ProtectionDomain, byte[]) line: not available
InstrumentationImpl.transform(ClassLoader, String, Class<?>, ProtectionDomain, byte[], boolean) line: not available
FloatingDecimal.readJavaFormatString(String) line: not available
FloatingDecimal.parseDouble(String) line: not available
Double.parseDouble(String) line: not available
reNameTester.main(String[]) line: 29

I'm using Eclipse 20-03 IDE and all java items have been removed and reloaded more than once. Any suggestions will be gratefully received.
Re: Double( String ) not working [message #1823759 is a reply to message #1823738] Wed, 01 April 2020 07:25 Go to previous messageGo to next message
Eclipse UserFriend
What kind of exception? This also looks like a more general programming
question, not one specific to Eclipse, so it might be more suitable to places
like javaranch.com and stackoverflow.com.

[Updated on: Wed, 01 April 2020 10:58] by Moderator

Re: Double( String ) not working [message #1823773 is a reply to message #1823759] Wed, 01 April 2020 17:06 Go to previous message
Eclipse UserFriend
Thanks Nitin. I'll post there. I'm unsure of the exception type as I can't get a printout of the error.
John
Previous Topic:Attach Source not working
Next Topic:Files are opened in last active group of tabs
Goto Forum:
  


Current Time: Thu Jul 24 00:08:23 EDT 2025

Powered by FUDForum. Page generated in 0.12103 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top