Answer:
The following program are:
public class Value { // Define a class named Value which is public type
private boolean modified = false; // a Boolean instance variable named 'modified',
private int val;
public Value(int i) { val = i; }
public int getVal() { return val; }
public void setVal(int i) { val = i; modified = true; }
public boolean wasModified() { return modified; }
}
Step-by-step explanation:
Firstly, a class defines "Value" and then take a Boolean variable "modified" initialize the value false and then take an integer variable "val" and after that we create a constructor taking a parameter in which variable is assigned to the "val" and then we create an integer type function "getVal()" which returns the value of the "val", and then we create a void type function "setVal()" which takes parameter assign to the value to the "val" and we set the value in the "modified" is true and after all we create a Boolean type function, "wasModified()" which give an output true, if the function "setVal()" was called