Please Help with BufferedReader class. Thanks.


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: Please Help with BufferedReader class. Thanks.

  1. #1
    markospolo Guest

    Please Help with BufferedReader class. Thanks.


    Hi everyone would someone please help me with bufferedReader class i am having
    problems with it. it trows some nullPointer Exception at me. here is my code.
    It compiles with no errors but gives an error in run. I'd like just go get
    a tip how i can avoid that error with not much change to what i do because
    i am just starting. Thanks.

    import java.io.*; class arrayGrades {


    BufferedReader s;

    public arrayGrades() throws IOException{

    //System.out.println("Object arrayGrades created");

    BufferedReader s= new BufferedReader(new InputStreamReader(System.in));

    }

    private String sStudent () throws IOException {

    //String s = System.in.read String v="";
    System.out.println("Please Enter Students Name");

    v = (String)s.readLine();
    System.out.println(v);


    return v; }

    private String sGrade () throws IOException{

    return "33";

    }

    public static void main (String args [] ) throws IOException{ int i=0;

    arrayGrades x = new arrayGrades();

    do {

    System.out.println(x.sStudent()); x.sGrade();
    i++;

    }while (i<3); } // Main
    } // class


  2. #2
    MarkosPolo Guest

    Re: Please Help with BufferedReader class. Thanks.


    Problem was solved.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center