File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Java in General and the fly likes Program execution discrepancies Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Program execution discrepancies" Watch "Program execution discrepancies" New topic

Program execution discrepancies

Olakunle Oladipo Oni

Joined: Aug 28, 2008
Posts: 18
I'm presenting two sample java code here...I'll appreciate if someone can give me an explanation at getting the expected outcome I believe there's something i need to learn here...

code sample one

I had no problem with compiling this code. I ran it as well. It didn't give any visible error or exception but nothing was printed out which is against my explanation. I supplied the appropriate runtime arguement as indicated in the code yet it ran(as it were) and printed nothing. How can this code print the text indicated?

code sample two

Just like the first sample, this code compliled successfuly. At runtime, i supplied the appropriate arguement to show successful payroll processing but no matter the arguements i supplied i keep getting only "Error...exiting". How do i get around this?

olakunle oni
Rob Spoor

Joined: Oct 27, 2005
Posts: 20279

Never ever ever use == to compare Strings, use the equals method:

How To Ask Questions How To Answer Questions
Olakunle Oladipo Oni

Joined: Aug 28, 2008
Posts: 18
I appreciate your response. This is the advantage of forums like this. I just saw something i overlooked...
I agree. Here's the link:
subject: Program execution discrepancies
jQuery in Action, 3rd edition