i have been strugling to identify my error but i have failed to solve the problem my code errors is incompatible types in line 11.

import java.io.*;
public class Appliance
{
public static void main(String args[])
{
try
{
File file=new File("Name.txt");
FileReader f=new FileReader(file);
int ch;
while(ch=f.read())
{
System.out.print((char)ch);
}
}
catch(FileNotFoundException fnfe)
{
System.out.println("Exception: "+fnfe.toString());
}
catch(IOException ioe)
{
System.out.println("Exception: "+ioe.toString());
}
}
}

While needs a boolean.

while((ch = f.read()) != -1)

Now, you look at the API docs and/or the Java IO Tutorials and tell me what that line is now doing and how it is different from yours.

Edit: And format your code!

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.