I am compiling my code in DOS command prompt and keep getting the following errors. I've attached the code below the errors. Thanks for any help.
C:\Program Files\Java\jdk1.6.0_20\My Work Files\Chapter 3>javac hobbits.java
hobbits.java:5: class, interface, or enum expected
public static void main(
String [] args) {
^
hobbits.java:8: class, interface, or enum expected
int z = -1;
^
hobbits.java:10: class, interface, or enum expected
while (z < 2) {
^
hobbits.java:12: class, interface, or enum expected
h[z] = new Hobbits();
^
hobbits.java:13: class, interface, or enum expected
h[z].name = "bilbo";
^
hobbits.java:14: class, interface, or enum expected
if (z == 1) {
^
hobbits.java:16: class, interface, or enum expected
}
^
hobbits.java:19: class, interface, or enum expected
}
^
hobbits.java:21: class, interface, or enum expected
System.out.println("good Hobbit name");
^
hobbits.java:23: class, interface, or enum expected
}
^
10 errors
MY CODE IS AS FOLLOWS: