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

