still not solve reading a file problem
members here i s a bug which is not yet solved as per my littele knowledge it doesnot read the documents content and prints it on command line any input from is most apprciated
her is code
"
import java.io.*;
class read
{
public static void main(String args[]) throws IOException
{
String line;
String[] full=new String[10];
int count=0;
FileInputStream fis=new FileInputStream("sampledocument.doc");
DataInputStream input= new DataInputStream("fis");
while((line= input.readLine())!=null)
{
System.out.println("line");
count++;
full[count]=line;
}
}
}
error given is
javac read.java
read.java:11: cannot find symbol
symbol :construtor DataInputStream(java.lang.String)
location:class java.io.DataInputStream
DataInputStream input = new DataInputStream("fis");
Note :read.java uses or overrides a deprecated API.
Note :Recompile with -Xlint:deprecation for details.
1 error.
Code tags look like this
[code]import javax.swing.*;
public class MyClass {
...
}
[/code]
You can type them in or generate them by pressing the button labeled
"code" above the message text area, when you are composing a reply.
but still by removing quotes i am not getting out put here is modified code
import java.io.*;
class read
{
public static void main(String args[]) throws IOException
{
String line;
String[] full=new String[10];
int count=0;
FileInputStream fis=new FileInputStream("sampledocument.txt");
DataInputStream input= new DataInputStream(fis);
while((line= input.readLine())!=null)
{
System.out.println("line");
count++;
full[count]=line;
}
}
}
it creates out put on single line as "line " where as in original text i have written i mean to say in text file
when going gets tough ,ough gets going.
sorry buddy being a begginer i may commit mistake plz try to rectify me
i regret plz , am sorry plz , hey got it its now running very smothly and nicely
when going gets tough , tough gets going
enjoy learning java
cheers,
java master 2005