I have three java files , i am pasting them here. Please show me the errors. Compilation error in Cat.java
File 1 : Dog.java
public class Dog extends Animal {
public String noise() { return "back"; }
}
File 2 : Cat.java
public class Cat extends Animal {
public String noise() {
return "meow";
)
}
File 3:AnimalTest.java
public class AnimalTest {
public static void main(String[] args)
{
Animal animal = new Dog();
//Cat cat = (Cat)animal;
Cat cat = new Cat();
System.out.println(cat.noise());
}
}
Output :
D:\>javac AnimalTest.java
.\Cat.java:4: illegal start of expression
)
^
.\Cat.java:5: ';' expected
}
^
.\Cat.java:5: '}' expected
}
^
3 errors
Please help me. Not a homework.
File 2: Cat.java
2006-08-15
18:07:48
·
4 answers
·
asked by
K Ban
2
in
Computers & Internet
➔ Programming & Design
My Dear Nikihl nobody can terminate a class in java with semicolon.
2006-08-15
18:17:36 ·
update #1
Leave spelling mistake. Find the problem
2006-08-15
18:18:21 ·
update #2
Manju thank you. The editor was so, small i cannot differentiate between { and (.
Thanks. Your is Best Answer.
2006-08-15
18:21:43 ·
update #3