【发布时间】:2018-03-27 19:16:08
【问题描述】:
例如,我想创建一个反转arraylist顺序的方法
public void ReverseOrder (){
this.reversOrder();
System.out.println(this);
}
【问题讨论】:
标签: java arrays arraylist methods call
例如,我想创建一个反转arraylist顺序的方法
public void ReverseOrder (){
this.reversOrder();
System.out.println(this);
}
【问题讨论】:
标签: java arrays arraylist methods call
我不知道你为什么要这样做。有没有相同的用例?
无论如何,如果你想使用ArrayList 对象下的字段,那么你需要在你的类上扩展ArrayList 类,然后你就可以使用this 来做到这一点。如果您想自定义ArrayList 的方法,那么您需要覆盖这些方法。
【讨论】: