这是我的类IpdurationAccess
的代码如何通过函数调用输入序列号?
public class IpDurationAccess {
String clientAddress;
int duration;
public IpDurationAccess(String s,int b)
{
this.clientAddress=s;
this.duration=b;
}
public String getClientAddress() {
return clientAddress;
}
public void setClientAddress(String clientAddress) {
this.clientAddress = clientAddress;
}
public int getDuration() {
return duration;
}
public void setDuration(int duration) {
this.duration = duration;
}
public void displayContent()
{
System.out.print( clientAddress+"\t");
System.out.print(duration);
System.out.println();
}
}
返回此代码我希望输出IP地址,持续时间以及序列号。如何使用displaycontent()
方法?
Iterator iterator;
System.out.println("IP Address \t Bytes Used ");
iterator = logarray.iterator();
int count = 1;
while (iterator.hasNext())
{
IpDurationAccess item= (IpDurationAccess)iterator.next();
item.displayContent();
}