12/13 cant get to work?


#1




Why wont this work?


#2

checkStatus.spike() //wrong

it must be

spike.checkStatus();


#3

nope...it still gives me the same error.


#4

can you please give the full screen shot?


#5

Never mind i got it ,but thanks anyways.


#6

class Dog extends Animal {

int age;

public Dog(int dogsAge) {
age = dogsAge;

}

public void bark() {

System.out.println("Woof!");

}

public void run(int feet) {

System.out.println("Your dog ran " + feet + " feet!");

}

public int getAge() {

return age;

}

public static void main(String[] args) {

Dog spike = new Dog(5);
spike.bark();
spike.run(40);
int spikeAge = spike.getAge();
System.out.println(spikeAge);
spike.checkStatus();

}

}


#7

Dog.java:11: error: illegal start of type
public void bark({
^
Dog.java:11: error: ')' expected
public void bark({
^
Dog.java:12: error: ';' expected
System.out.println("Woof!");}
^
Dog.java:12: error: expected
System.out.println("Woof!");}
^
Dog.java:12: error: illegal start of type
System.out.println("Woof!");}
^
Dog.java:14: error: class, interface, or enum expected
public void run(int feet){
^
Dog.java:18: error: class, interface, or enum expected
}
^
Dog.java:20: error: class, interface, or enum expected
public int getAge(){
^
Dog.java:24: error: class, interface, or enum expected
}
^
Dog.java:26: error: class, interface, or enum expected
public static void main(String[] args) {
^
Dog.java:30: error: class, interface, or enum expected
Dog spike = new Dog(5);
^
Dog.java:32: error: class, interface, or enum expected
spike.bark();
^
Dog.java:34: error: class, interface, or enum expected
spike.run(345);
^
Dog.java:36: error: class, interface, or enum expected
int spikeAge = spike.getAge();
^
Dog.java:38: error: class, interface, or enum expected
System.out.println(spikeAge);
^
Dog.java:39: error: class, interface, or enum expected
}
^
16 errors


#8

i got it but thank you aney way!


#9

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.