Use an if statement in this code, why mine is not working

private static void testGetNumberOfBooks() {

Library library = new Library();

int numberOfBooks = library.getNumberOfBooks();

System.out.println(numberOfBooks);

}

private static void testGetName() {

Library library = new Library();

System.out.println(library.getName());

}

I am trying to modify this code above with an if statement.

private static void testGetNumberOfBooks() {

Library library = new Library();

int numberOfBooks = library.getNumberOfBooks();

If (2== numberOfBooks)

System.out.println(numberOfBooks);

Else (System.err.println (numberOfBooks));

}

private static void testGetName() {

Library library = new Library();

String libraryName = library.getName()

If (" Underfunded Dmacc Library".equals (libraryName){

System.out.println(libraryName));

Esle

System.err.println("Wrong Library");

}

[961 byte] By [jangaa] at [2007-11-26 18:55:55]
# 1
1. Use Code Tags2. Never say not working without defining what you mean and what it should do3. http://java.sun.com/docs/books/tutorial/java/nutsandbolts/if.html
zadoka at 2007-7-9 20:34:32 > top of Java-index,Java Essentials,New To Java...
# 2

If you have a problem, or an error, you need to tell us what it is. We can't read minds. Also, you should post code between [code]...[/code] tags, it makes it much easier to read.

If (2== numberOfBooks)

System.out.println(numberOfBooks);

Else (System.err.println (numberOfBooks));

If and else should not be capitalized.

CaptainMorgan08a at 2007-7-9 20:34:32 > top of Java-index,Java Essentials,New To Java...