Return tab[];

feno -  
 feno -
Bonjour à toutes et à tous,

alors voici ma question:
j'ai créée une classe compte dont les attributs sont le nom, le prenom, le solde, puis le numero de compte et le code confidentiel du compte qui sont des tableaux. mais mon problème c'est je n'arrive pas à returner ces deux tableaux à travers les accesseurs
public int getNumeroCompte() et public int getCode() dans mon main()!!! voici quelques parties de ce programme et en gras italique les deux méthodes avec lesquelles j'ai du mal. Je vous remercie.

//import java.util.Scanner;
public class Compte
{ //Scanner lu=new Scanner(System.in);

private String nom;
private String prenom;
private double solde;
private int numeroCompte[];
private int code[];

public Compte()
{ System.out.println(" VOTRE COMPTE A ETE CREE !");
String nom="";
String prenom="";
double solde=0;
this.numeroCompte=new int[8];
this.code=new int[4];
}

public Compte(String nom,String prenom,double init,int tab[])
{ System.out.println();
System.out.println(" VOS PARAMETRES ONT ETE INITIES ! ");
this.nom=nom;
this.prenom=prenom;
this.solde=init;
for(int i=0;i<tab.length;i++)
this.numeroCompte[i]=tab[i];
for(int i=0;i<4;i++)
{ int j=4;
this.code[i]=tab[j];
j++;
}
}
.
.
.
.
.
public int getNumeroCompte()
{ return this.numeroCompte;
}


public int getCode()
{ return this.Code;
}

.
.
.
.
.
}

public static void main(String[]agrs)
{

int tab1=new int[];
int tab2=new int[];

tab1=getNumeroCompte();
tab2=getCode();

}
A voir également:

1 réponse

feno
 
bonjour Anonyme, alors concernant ta question , je suis sur Windows Vista, merci.
0