Safekeeping Secrets in a Magic Box

Report a typo

How could you construct a custom class in Java to securely hold any type of data and allow the stored value to be accessed or updated at any time? Consider implementing a class that uses Java generics to achieve this functionality.

Fill in the gaps with the relevant elements
  Container<> {
    private T value;
    public Container(T value) { this.value = value; }
    public T getValue() { return value; }
    public void setValue(T value) { this.value = value; }
}

Create a free account to access the full topic