Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    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 06:43 Go to next message
John Sharples is currently offline John SharplesFriend
Messages: 3
Registered: June 2019
Junior Member
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 11:25 Go to previous messageGo to next message
Nitin Dahyabhai is currently offline Nitin DahyabhaiFriend
Messages: 3706
Registered: July 2009
Senior Member

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.


Nitin Dahyabhai
Eclipse Web Tools Platform

[Updated on: Wed, 01 April 2020 14:58]

Report message to a moderator

Re: Double( String ) not working [message #1823773 is a reply to message #1823759] Wed, 01 April 2020 21:06 Go to previous message
John Sharples is currently offline John SharplesFriend
Messages: 3
Registered: June 2019
Junior Member
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: Tue May 26 14:16:45 GMT 2020

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

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

Back to the top