fork download
  1. interface Rideable {
  2. String getGait();
  3. }
  4.  
  5. public class Camel implements Rideable {
  6. int weight = 2;
  7.  
  8. public static void main(String[] args) {
  9. new Camel().go(8);
  10. }
  11.  
  12. void go(int speed) {
  13. ++speed;
  14. weight++;
  15. int walkrate = speed * weight;
  16. System.out.print(walkrate + getGait());
  17. }
  18.  
  19. String getGait() {
  20. return " mph, lope";
  21. }
  22. }
  23.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Main.java:5: error: class Camel is public, should be declared in a file named Camel.java
public class Camel implements Rideable {
       ^
Main.java:19: 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