Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 3 of 3

Thread: Error by Using DataInputStream

  1. #1
    Junior Member
    Join Date
    Jan 2011
    Posts
    17
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Smile Error by Using DataInputStream

    Hi All,

    This is kiran . I wrten a simple code using "DataInputStream" in arrays . am geting error while compiling the program . Below shown is my program

    import java.io.*;
    class FirstArray
    {
    public static void main(String arg[])throws Exception
    {
    int marks[]=new int[6];
    String name;
    DataInputStream d = new DataInputStream(System.in);
    System.out.println("enter the name ");
    name = d.readline();
    System.out.println("enter marks");
    for(int i=0;i<=5;i++)
    marks[i] = Integer.parseInt(d.readline());
    System.out.println("name is :"+name);
    for(int i=0;i<=5;i++)
    System.out.println("  "+marks[i]);
    }
    }

    "AND THE ERROR IS"

    C:\Java>javac FirstArray.java
    FirstArray.java:10: cannot find symbol
    symbol : method readline()
    location: class java.io.DataInputStream
    name = d.readline();
    ^
    FirstArray.java:13: cannot find symbol
    symbol : method readline()
    location: class java.io.DataInputStream
    marks[i] = Integer.parseInt(d.readline());
    ^
    2 errors

    Please give me the solution for this error .


  2. #2
    Administrator copeg's Avatar
    Join Date
    Oct 2009
    Location
    US
    Posts
    5,320
    Thanks
    181
    Thanked 833 Times in 772 Posts
    Blog Entries
    5

    Default Re: Error by Using DataInputStream

    I'd recommend looking at the API for DataInputStream...there is no method defined for readline (java is case sensitive), and for the method I expect you with to use, readLine is deprecated.

  3. #3
    Junior Member
    Join Date
    Jan 2011
    Posts
    17
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Smile Error by Using DataInputStream

    tanq soo much the error get solved