Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

BufferedReader continuous loop

 
Gabriel White
Ranch Hand
Posts: 233
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi yall, I have some code here that is giving me some problems.



I have declared searchName as a char local data type and myLastName as a String ""; local data object...both at the top of this method called getUserInput.

When the program asks the user to input the name that they want to search for in the Ragged array [months][days in that month] it just just doesn't seem to pass the myLastName into the searchAppointments method correctly.

Here is that code:


Thanks in advance.
 
marc weber
Sheriff
Posts: 11343
Java Mac Safari
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
if (searchName == lname)...

Well, if you're comparing Strings, then you will want to use the equals method to compare the "contents" of the Strings, instead of a simple reference comparison (==).

if(searchName.equals(lname))...

(Also, you might consider String's compareToIgnoreCase method.)
 
Gabriel White
Ranch Hand
Posts: 233
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Mark, that was a total brain fart there. Can you see why I would be getting a null pointer exception when I call that?

I can print out every column and row and I can visually see the string object that is in the ragged array. It is just not picking it up.

I can see them when I do a SOP(calendar[row][col]);

weird.
 
marc weber
Sheriff
Posts: 11343
Java Mac Safari
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic