java 容器
Posted 麦好
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了java 容器相关的知识,希望对你有一定的参考价值。
package dplearn;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
public class Learn {
public static void main(String[] args){
List myList=new ArrayList();
Basicinfo myBasic=new Basicinfo("虎头牌笔记本",3.5f,"red");
myList.add(myBasic);
myBasic=new Basicinfo("A4纸",3.5f,"white");
myList.add(myBasic);
myBasic=new Basicinfo("B2铅笔",3.5f,"black");
myList.add(myBasic);
Iterator iterator=myList.iterator();
while (iterator.hasNext()){
Basicinfo bsinfo=(Basicinfo)iterator.next();
System.out.println(bsinfo.info());
}
}
}
本博客所有内容是原创,如果转载请注明来源
http://blog.csdn.net/myhaspl/
package dplearn;
public class Basicinfo {
String name;
float price;
String color;
public Basicinfo(){
name="";
price=0;
color="";
}
public Basicinfo(String name,float price,String color){
this.name=name;
this.price=price;
this.color=color;
}
public String info(){
return this.name+"=>"+this.price+"=>"+this.color;
}
}
以上是关于java 容器的主要内容,如果未能解决你的问题,请参考以下文章
使用 BottomBar 和片段容器禁用 Android 片段重新加载