当前位置:编程学习 > JAVA >>

class文件生成不了




指导下 --------------------编程问答-------------------- 都是语法错误吧,把代码贴上来吧 --------------------编程问答-------------------- 没有valuebean的包 引入包错误 --------------------编程问答-------------------- 导入包的问题,你确定你的包是存在的么? --------------------编程问答-------------------- 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();
}
}



是真的看不懂,各位指导下
补充:Java ,  Java SE
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,