override interface method with different parameters java

Solutions on MaxInterview for override interface method with different parameters java by the best coders in the world

showing results for - "override interface method with different parameters java"
Ana Sofia
16 Apr 2019
1public interface Order
2{
3    public boolean greaterThan(Order other);
4}
5
6
7public class AirCraft implements Order
8{
9   private String make;
10   private int numSeats;
11
12   public AirCraft(String make, int numSeats)
13   {
14      this.make = make;
15      this.numSeats = numSeats;
16   }
17
18   public String getMake()
19   {
20      return make;
21   }
22
23   public int getNumSeats()
24   {
25      return numSeats;
26   }
27
28   @Override
29   public boolean greaterThan(Order other)
30   {
31      AirCraft x = (AirCraft)other;
32      return getNumSeats() > x.getNumSeats();
33   }
34   
35   public String toString()
36   {
37       return make + " -> " + numSeats;
38   }
39}