package CHAPTER09;

interface Storage<T> {
    void store(T item); // 데이터를 저장
    T retrieve();       // 저장된 데이터를 반환
}
class StringStorage implements Storage<String> {
    private String item;

    @Override
    public void store(String item) {
        this.item = item;
    }

    @Override
    public String retrieve() {
        return item;
    }
}
class GenericStorage<T> implements Storage<T> {
    private T item;

    @Override
    public void store(T item) {
        this.item = item;
    }

    @Override
    public T retrieve() {
        return item;
    }
}
public class GenericInterface {
	public static void main(String[] args) {		
        Storage<String> stringStorage = new StringStorage();
        stringStorage.store("Hello");
        System.out.println(stringStorage.retrieve()); 
       
        Storage<Integer> intStorage = new GenericStorage<>();
        intStorage.store(123);
        System.out.println(intStorage.retrieve()); 
	}
}
