fork download
  1. interface Rideable {
  2. String getGait();
  3. }
  4. public class Camel implements Rideable {
  5. int weight = 2;
  6. public static void main(String[] args) {
  7. new Camel().go(8);
  8. }
  9. public void go(int speed) {
  10. ++speed;
  11. weight++;
  12. int walkrate = speed * weight;
  13. System.out.print(walkrate + getGait());
  14. }
  15. String getGait() {
  16. return " mph, lope";
  17. }
  18. }
  19.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Main.java:4: error: class Camel is public, should be declared in a file named Camel.java
public class Camel implements Rideable {
       ^
Main.java:15: error: getGait() in Camel cannot implement getGait() in Rideable
String getGait() {
       ^
  attempting to assign weaker access privileges; was public
2 errors
stdout
Standard output is empty