File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes read a Double from a File Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Java in General
Reply Bookmark "read a Double from a File " Watch "read a Double from a File " New topic
Author

read a Double from a File

Dhan Priyan
Greenhorn

Joined: May 10, 2009
Posts: 12
Hai, I have some file xx.txt, it has the double values stored in it like below

1.2 1.4 23.44 12.78
23.4 12.45 23.0 10.4

i wanted to read this file and print to the Screen
I tried with my knowledge up to the following level. could any one help me to find the way.

thanks

Steve Luke
Bartender

Joined: Jan 28, 2003
Posts: 3040
    
    4

Nothing stands out at me from the code you posted. Does it work for you? What does it not do that you want it to? What is wrong with it?

You might also consider using the Scanner class (see the API here) instead of the DataInputStream. I think it is a bit easier to use.

Steve
Steve Luke
Bartender

Joined: Jan 28, 2003
Posts: 3040
    
    4

Also posted over at the Sun Java Forums.

Dhan, generally you should post to one forum, then expand to more forums only when/if you don't get satisfactory answers. Then, when you do crosspost Please be Forthright about it, and let everyone involved know about the concurrent conversations that are going on. That way there is more collaboration and less duplication of work.
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: read a Double from a File
 
Similar Threads
FileInputStream Initialization...
Read, translate to hex, write?
Hai i need Help in FileOutputStream !
return to sender
Query in code of displaying a text file