Hallo,
erstmals möchte ich sagen, dass ich heute mit der JAVA Programmierung begonnen habe. Bis jetzt programmierte ich mit Visual Basic .NET und VB 6.0
Aber egal... Vielleicht könnte mir einer von euch erklären, was in diesem Code falsch ist?
Dabei stehts so in meinem Buch...
Ich möchte mich jetzt schon für die netten ANtworten bedanken! ^^
class Jabberwock {
String color;
String sex;
boolean hungry;
void feedJabberwock() {
if (hungry == true) {
System.out.println("Yum -- a peasant!");
hungry = false;
} else
System.out.println("No, thanks -- already ate.");
}
void showAttributes() {
System.out.println("This is a " + sex + " " + color + " jabberwock.");
if (hungry == true)
System.out.println("The jabberwock is hungry.");
else
System.out.println("The jabberwock is full.");
}
}
erstmals möchte ich sagen, dass ich heute mit der JAVA Programmierung begonnen habe. Bis jetzt programmierte ich mit Visual Basic .NET und VB 6.0
Aber egal... Vielleicht könnte mir einer von euch erklären, was in diesem Code falsch ist?
Dabei stehts so in meinem Buch...
Ich möchte mich jetzt schon für die netten ANtworten bedanken! ^^
class Jabberwock {
String color;
String sex;
boolean hungry;
void feedJabberwock() {
if (hungry == true) {
System.out.println("Yum -- a peasant!");
hungry = false;
} else
System.out.println("No, thanks -- already ate.");
}
void showAttributes() {
System.out.println("This is a " + sex + " " + color + " jabberwock.");
if (hungry == true)
System.out.println("The jabberwock is hungry.");
else
System.out.println("The jabberwock is full.");
}
}