File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes BufferedReader continuous loop Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "BufferedReader continuous loop" Watch "BufferedReader continuous loop" New topic
Author

BufferedReader continuous loop

Gabriel White
Ranch Hand

Joined: Mar 02, 2003
Posts: 233
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

Joined: Aug 31, 2004
Posts: 11343

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.)


"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer
sscce.org
Gabriel White
Ranch Hand

Joined: Mar 02, 2003
Posts: 233
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

Joined: Aug 31, 2004
Posts: 11343

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: BufferedReader continuous loop