Hello All. This is my first posting in Javaranch.
I was reading
alot of posts over here and looks to me this forum is much better than
java forums. people are polite and are willing to help a noob or advance person with their java query rather than busting them and giving google searches to do their own work.
I have been programming in java for 9 months. I really like it. The best OOP i have ever experience after C++. i hate pointers and data structures and i am glad with Java you dont need to know about data structures alot. where as in C++ most of the things are done with pointers. Anyway back to my question
I am having alot of trouble in file reading. like for example i have a file something like this :
Name Product price quantity
xyz Wheels $20.25 10
abc Jam $3.01 1
Now my question is how can i read each specific line in java. whats the strategy i had to use ? i know BufferedReader and string.split is used alot in file reading but i am really very confused. any hints or any example or any strategies in reading a text file and having the output also in a file or in a program will be great.
Secondly here is one more example
Name: Suleman Zia
Class: COSI455
Subject: Java
Grade: B
Name: Rahim
Class Abc
Subject: History
Grade: C
How can i read this text file and displaying the output for each specific person. once i can display then i can encapsulate my data and can call addition? The question remains the same. how can i read this text file data for each person? Hope you can understand now what i am trying to say.
One more question what is the difference between DataOutputStream and PrintOutputStream File file = new File("saloo.txt").
Too many questions. hope to get some help in understanding the file system.
Secondly what if i would like to store the data in a ArrayList or Set? i know how to do it in a regular program. Give me a program to write with HasSet or Map and i will make sure to complete that task easily may be not that easily but what if i would like to store all of the text data or may be the first row in an arraylist or vector then how can i do it?
Thanks for the help and i really appreciate it.
[ April 21, 2007: Message edited by: Suleman zia ]