Jump to content

  • Log In with Google      Sign In   
  • Create Account

[java] Console input


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
3 replies to this topic

#1 GKW   Members   -  Reputation: 200

Like
Likes
Like

Posted 05 October 2000 - 10:02 AM

Why does this work public class someclass { InputStreamReader isr; BufferedReader br; public someclass() { isr = new InputStreamReader( System.in ); br = new BufferedReader( isr ); } public getinput() { get input for console } } and I get a NullPointerException with this in getinput() with respect to the BufferedReader? public class someclass { InputStreamReader isr; BufferedReader br; public someclass() { setupIO(); } public void setupIO() { isr = new InputStreamReader( System.in ); br = new BufferedReader( isr ); } public getinput() { get input for console } } btw new beta of Forte For Java out for those who don''t know. I wanrned you! Didn't I warn you?! That colored chalk was forged by Lucifer himself!

Sponsor:

#2 latrobe   Members   -  Reputation: 122

Like
Likes
Like

Posted 05 October 2000 - 10:58 AM

I was able to use either method and access br in the getinput method.

Is it possible you have BufferedReader br = new BufferedReader(isr) in your second situation...if so, you need to remove the BufferedReader from in front of br.

Hope this helps

#3 GKW   Members   -  Reputation: 200

Like
Likes
Like

Posted 05 October 2000 - 06:44 PM

God damn it, you are right. But can you figure out why last night the program would find another class in the same package and today it can''t find it. Compiles in the command line but not in the IDE. Same paths and all. I will try and pull my head out of my ass before I post again. Thanks.

I wanrned you! Didn't I warn you?! That colored chalk was forged by Lucifer himself!

#4 latrobe   Members   -  Reputation: 122

Like
Likes
Like

Posted 06 October 2000 - 11:28 AM

Would need some more info on your second problem but I would guess it is related to classpaths (but it looks like you were checking those).






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS