Home » questions » Typical problem in java program ?
Typical problem in java program ?
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
My Dear Nikihl nobody can terminate a class in java with semicolon.
Leave spelling mistake. Find the problem
Manju thank you. The editor was so, small i cannot differentiate between { and (.
Thanks. Your is Best Answer.

Answers
Neelesh K
On 2006-08-15 23:49:14
Nikhil G
On 2006-08-15 22:12:22
manju
On 2006-08-15 22:18:21
vinny_the_hack
On 2006-08-15 22:16:56