Code: Select all
interface Rideable {
String getGait();
}
public class Camel implements Rideable {
int weight = 2;
public static void main(String[] args) {
new Camel().go(8);
}
void go(int speed) {
++speed;
weight++;
int walkrate = speed * weight;
System.out.print(walkrate + getGait());
}
String getGait() {
return " mph, lope";
}
}
1. But my question is: I haven't reduced the visibility its the same as inherited method then why is the error?
After making the method public when i try to execute it shows the following message - " Exception in thread "main" java.lang.NoSuchMethodError: main"
What is the problem with the code?
How do i make it work?
Please advise,
Regards,
Deepa.