DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 2 of 2
  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.

Bookmarks

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


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links