java 获取 list 类型数据_怎样取到ArrayList中的数据类型

展开全部

ArrayList 存放的是一个泛型,所以只能把它当成Object类型来使用

所以从思路上来说 你就只能看Object这个62616964757a686964616fe59b9ee7ad9431333337396334类的成员函数

Object有一个成员函数getClass() 通过它可以取出List中某一个对象的举起的类/**

* Returns the unique instance of {@link Class} that represents this

* object's class. Note that {@code getClass()} is a special case in that it

* actually returns {@code Class extends Foo>} where {@code Foo} is the

* erasure of the type of the expression {@code getClass()} was called upon.

* As an example, the following code actually compiles, although one might

* think it shouldn't:

{@code

*   List l = new ArrayList();

*   Class extends List> c = l.getClass();}

*

* @return this object's {@code Class} instance.

*/

public final native Class> getClass();

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值