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

class 1

Shawn Mountcastle

Joined: Feb 09, 1999
Posts: 26
I'm stuck on Assignment 1.2 (EvenOrOdd) and can't figure out what I'm doing wrong. The error message I get is: "method If (boolean) not found in class EvenOrOdd."
Here's the program (so far):
public class EvenOrOdd
public static void main ( String args [0] )
String s = args [0];
int n = Integer.parseInt ( s );
If ( ( n % 2 ) == 0 );
{ System.out.print ( "Even!" );
paul wheaton

Joined: Dec 14, 1998
Posts: 20972

Remember that Java is case sensitive.
In this case, java does not have a structure called "If" so it's looking for that method (which it cannot find).
Java does have a structure called "if".

permaculture Wood Burning Stoves 2.0 - 4-DVD set
Shawn Mountcastle

Joined: Feb 09, 1999
Posts: 26
I thought I posted this question yesterday but I don't see it anywhere, so here it is again:
OOPS. Found it.
[This message has been edited by Shawn Mountcastle (edited May 12, 1999).]
Pin Ting

Joined: May 28, 2003
Posts: 22
Originally posted by Matt Midcap:

Solution (for my problem was): One wierd thing about WordPad (on Windows98, not NT) is that although you save your file as a .txt file (, it actually saves it as ""!
Try going to the DOS prompt, go to where you saved the file and type DIR. If the name is "" you'll have to change it manually at the DOS prompt.

Actually, this is more like an OS property setting problem. In the "Folder Options" settings, you can select whether to show the file extension name or not.

Never do things the hard way if you don't have a good reason.
Marilyn de Queiroz

Joined: Jul 22, 2000
Posts: 9059
It seems that the problem Matt pointed out had more to do with the behaviour of WordPad renaming the file rather than whether it showed the extension or not.

"Yesterday is history, tomorrow is a mystery, and today is a gift; that's why they call it the present." Eleanor Roosevelt
I agree. Here's the link:
subject: class 1
It's not a secret anymore!