Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
编写一个类声明,通过它可以与任何类型的数据进行交互。
这是我的试卷问题之一。我不清楚如何为这个问题写一个答案。如果我用不同类型的参数更改数据类型覆盖方法是否正确?
不?!:-)
public class DataHolder<T> { private T data; public T getData() { return data; } public void setData(T data) { this.data = data; } }