How to take in values from an Input File

Hi Guys

I'm a newbie when it comes to Java. I been trying to learn Java for my internship. Right now I'm able to read in 2 files and print them out to an outfile. What I want to do is store a value in a string from 1 input flie.I have really tried to fiqure this out by myself, but I'm so frustrated now.If you guys don't mind, can you help me please. Here is my java code :

import java.io.*;

import java.io.FileReader;

import java.io.FileWriter;

import java.lang.*;

class FileReadTest {

public static void main(String[] args) {

FileReadTest f = new FileReadTest ();

FileReadTest a = new FileReadTest ();

a.readMyfile();

f.readMyfile ();

}

void readMyfile (){

FileOutputStream out = null;

PrintStream p = null;

DataInputStream dis = null;

DataInputStream dis2= null;

String str = null;

String str2 = null;

int recCount = 0;

FileReader inputStream = null;

FileWriter outStream = null;

String str3;

try {

File f = new File ("C:\\vendor.txt");

FileInputStream fis = new FileInputStream (f);

BufferedInputStream bis = new BufferedInputStream (fis);

dis = new DataInputStream (bis);

out = new FileOutputStream ("C:\\report.txt");

p = new PrintStream (out);

try {

File a = new File("C:\\lookup.txt");

FileInputStream is = new FileInputStream (a);

BufferedInputStream bs = new BufferedInputStream(is);

dis2= new DataInputStream (bs);

String record, field;

char delim = ':';

while (( str2 = dis2.readLine())!=null)

{

System.out.println(str2);

p.println(str);

p.println(str2);

while ((str = dis.readLine())!=null)

{

p.println(str);

}

}

}

catch(Exception e){

System.out.println(e.getMessage());

}

}

catch(Exception e){

System.out.println(e.getMessage());

}

}

}

I would like to store a value from my input value. Thank you Louis

[2083 byte] By [Louis345a] at [2007-11-27 7:12:54]
# 1

1) What exact problem are you having? You say you are able to read and write a file, right? What "storing" do you want to do that you can't? When you read a line, just put the result in a variable.

2) When you post code, please use[code] and [/code] tags as described in [url=http://forum.java.sun.com/help.jspa?sec=formatting]Formatting tips[/url] on the message entry page. It makes it much easier to read.

jverda at 2007-7-12 19:03:51 > top of Java-index,Java Essentials,Java Programming...