public class Facture {
private Client client = new Client();;
private float Paiement;
private float soustotal;
private float tps;
private float tvq;
private float ttc;
private List<LigneFacture> lignesFac = new ArrayList<LigneFacture>();
public Facture(){
this.Paiement=0;
this.soustotal=0;
this.tps=0;
this.tvq=0;
this.ttc=0;
}
public Client getClient() {
return client;
}
public void setClient(Client client) {
this.client = client;
}
public float getPaiement() {
return Paiement;
}
public void setPaiement(float Paiement) {
this.Paiement = Paiement;
}
public float getSoustotal() {
return soustotal;
}
public void setSoustotal(float soustotal) {
this.soustotal = soustotal;
}
public float getTps() {
return tps;
}
public void setTps(float tps) {
this.tps = tps;
}
public float getTvq() {
return tvq;
}
public void setTvq(float tvq) {
this.tvq = tvq;
}
public float getTtc() {
return ttc;
}
public void setTtc(float ttc) {
this.ttc = ttc;
}
public List<LigneFacture> getLignesFac() {
return lignesFac;
}
public void addLignesFacture(LigneFacture ligneFac){
this.lignesFac.add(ligneFac);
Iterator iter_lignesFact = lignesFac.iterator();
while(iter_lignesFact.hasNext()){
LigneFacture lignefac_cur = iter_lignesFact.next();
}
}
}
嗨,我有这个类,问题出在最后一个方法中,Java 告诉我 iter_lignesFact 返回一个 Object 值而不是 LigneFacture 值,因此他希望我将它转换为 LigneFacture,这是为什么呢?我在 LigneFacture 列表上定义了我的迭代器。