116k views
3 votes
Write an interface named HGTTU which specifies a universal constant int value of 42, and a single method named getNormilazedIntValue that takes no parameters and returns an int. The purpose of which is to get the value of the object's int instance variable, add the universal constant and return the result.Next, write a second named myInt which is composed of a single int instance variable (and the minimal set of customary methods) that implements HGTTU.

User Nakamume
by
6.0k points

1 Answer

2 votes

Answer:

Hope this helps.

//HGTTU.java

public interface HGTTU {

int universalConstant = 42;

public int getNormilazedIntValue();

}

//MyInt.java

public class MyInt implements HGTTU {

int instanceFiled;

Override

public int getNormilazedIntValue() {

return instanceFiled+universalConstant;

}

}

Step-by-step explanation:

User Jose Zamudio
by
5.5k points