class文件生成不了 没有valuebean的包 引入包错误 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 valuebean必须在classpath中才行,看看环境变量的设置和valuebean文件夹的路径 package toolbean;import java.util.ArrayList;import valuebean.GoodsSingle;public class ShopCar { private ArrayList buylist = new ArrayList(); public ArrayList getBuylist(){ return buylist; }/** * @功能 向购物车中添加商品 * @参数single为GoodsSingle类对象,封装了要添加的商品信息 */ public void addItem(GoodsSingle single){ if(single!=null){ if(buylist.size()==0){ GoodsSingle temp = new GoodsSingle(); temp.setName(single.getName()); temp.setPrice(single.getPrice()); temp.setNum(single.getNum()); buylist.add(temp); } else{ int i=0; for(;i<buylist.size();i++){ GoodsSingle temp=(GoodsSingle)buylist.get(i); if(temp.getName().equals(single.getName())){ temp.setNum(temp.getNum()+1); break; } } if(i>=buylist.size()){ GoodsSingle temp = new GoodsSingle(); temp.setName(single.getName()); temp.setPrice(single.getPrice()); temp.setNum(single.getNum()); buylist.add(temp); } } } } /** * @功能 从购物车中移除指定名称的商品 * @参数 name表示商品名称 */ public void removeItem(String name){ for(int i=0;i<buylist.size();i++){ GoodsSingle temp = (GoodsSingle)buylist.get(i); if(temp.getName().equals(MyTools.toChinese(name))){ if(temp.getNum()>1){ temp.setNum(temp.getNum()-1); break; }else if(temp.getNum()==1){ buylist.remove(i); } } } } /** * @功能 清空购物车 */ public void clearCar(){ buylist.clear(); }}是真的看不懂,各位指导下 Socket实现多线程通信问题 SWT table 如何使得里面的内容可以复制 一段代码,问几个菜鸟问题,已经标注出来了。 如何 得到 2个list中相同的 部分(要求效率高一些) java的反射问题,谁帮帮小弟啊,getMethod和invoke怎么用哦 学习多线程用java好还是C++好? 有偿转让Java即时通信工具源程序及设计文档 Java新手 求助SCJP试题的问题! 对ID:2019和ID:lwg2019处理通知说明 我刚装了jbuilder8企业版,但创建jsp并编译时总是出现异常 java多线程的线程数统计 jframe上弹出Jdialog,但dialog上的控件不显示
import valuebean.GoodsSingle;
public class ShopCar {
private ArrayList buylist = new ArrayList();
public ArrayList getBuylist(){
return buylist;
}
/**
* @功能 向购物车中添加商品
* @参数single为GoodsSingle类对象,封装了要添加的商品信息
*/
public void addItem(GoodsSingle single){
if(single!=null){
if(buylist.size()==0){
GoodsSingle temp = new GoodsSingle();
temp.setName(single.getName());
temp.setPrice(single.getPrice());
temp.setNum(single.getNum());
buylist.add(temp);
}
else{
int i=0;
for(;i<buylist.size();i++){
GoodsSingle temp=(GoodsSingle)buylist.get(i);
if(temp.getName().equals(single.getName())){
temp.setNum(temp.getNum()+1);
break;
}
}
if(i>=buylist.size()){
GoodsSingle temp = new GoodsSingle();
temp.setName(single.getName());
temp.setPrice(single.getPrice());
temp.setNum(single.getNum());
buylist.add(temp);
}
}
}
}
/**
* @功能 从购物车中移除指定名称的商品
* @参数 name表示商品名称
*/
public void removeItem(String name){
for(int i=0;i<buylist.size();i++){
GoodsSingle temp = (GoodsSingle)buylist.get(i);
if(temp.getName().equals(MyTools.toChinese(name))){
if(temp.getNum()>1){
temp.setNum(temp.getNum()-1);
break;
}else
if(temp.getNum()==1){
buylist.remove(i);
}
}
}
}
/**
* @功能 清空购物车
*/
public void clearCar(){
buylist.clear();
}
}是真的看不懂,各位指导下