I am starting out in programming and have little knowledge of Java. I use linux and after a while got sick of using gedit and javac to learn. So I now use eclipse. I am trying to get input from a text file and when I write the code I get and error that says "outputStream cannot be resolved" (it also happens with inputStream). All your help is appreciated!

1) Did you import their package? // import java.io.*;
2) Java is case sensitive: OutputStream, InputStream
3) Do the above and then post code if they don't work

1) Did you import their package? // import java.io.*;
2) Java is case sensitive: OutputStream, InputStream
3) Do the above and then post code if they don't work

I fixed the case sensitive problem, and had the import package part right, but I still get the same problem. Thanks again for your help.

import java.io.*;

public class anything {

	public static void main(String[] args) {
		
		try {
			OutputStream = new FileWriter("timeremaining.txt");
			
			int c;
			
			while ((c = InputStream.read()) != -1) {
				OutputStream.write(10 - c);
			}
			
			finally {
			if (OutputStream != null) {
                OutputStream.close();
            }
				
			}
			
		}
		
	}

}

This is how you instantiate an Object:

NameOfClass noc = new NameOfClass();

Not like this:

[B]OutputStream[/B] = new FileWriter("timeremaining.txt");

And call the methods like this:

noc.method1();
int a = noc.method2();

It seems to me that you don't know the very basic of instantiating objects so forget about the reading from file stuff and practice more on the basics

Ok, thank you very much for your help. I'll definitely go back and do the basics again.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.