Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

Java 

Reading doubles from a file.

(May 3, 2013 02:41 PM)Gpure Wrote:  I tried those methods but it throwed a syntax error when I compared type double to Double.

It's only for my Intro to Computer Science class where the skill level is at a point of 3rd grade, and since I finished all the assignments, he told me to learn to write to a File.

I don't have the java developer kit on this computer, so, I can't really post working code, but, try something along these lines:-

Code
Double firstDouble = 45.6
Double secondDouble = Double.parseDouble("45.6");
firstDouble.compareTo(secondDouble) == (Double)0? System.out.println("We match!"); : System.out.println("We don't match");

And post the results, although, I'm sure that's not the most efficient way to test it, it's just the only way I can provide without downloading loads of shit.


Possibly Related Threads...
Thread / Author Replies Views Last Post
[C#] by Formula 1Dec 6, 2019 01:11 AM 23 708 Dec 6, 2019 01:11 AM
Last Post: itcorp
[C] by nuvexy.Oct 6, 2019 03:13 PM 13 525 Oct 6, 2019 03:13 PM
Last Post: themayonnaiseguy
[C#] by DeadShot32Oct 4, 2019 08:58 AM 14 446 Oct 4, 2019 08:58 AM
Last Post: MavenGradle