Question: We have written the following Class1 class: class Class1 implements SecretInterface { // instance variable private int x = 0; // constructor public Class1(int x)
We have written the following Class1 class:
class Class1 implements SecretInterface { // instance variable private int x = 0; // constructor public Class1(int x) { this.x = x; } // instance methods public double myMethod1(double x, double y) { return x - y; } public void myMethod2(int x) { System.out.println(x); } public String myMethod3(String x) { return "hi " + x; } } We have also written the following Class2 class:
class Class2 implements SecretInterface { // instance variable private int x = 1; // constructor public Class2(int x) { this.x = x; } // instance methods public double myMethod1(double a, double b) { return a + b; } public void myMethod2(double x) { System.out.println(x); } public String myMethod3(Object o) { return "hello"; } } TASK: Write the SecretInterface interface such that it contains the most possible attributes/methods possible given the implementations of Class1 and Class2 above.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
