Vous êtes sur la page 1sur 1

conctructeur par defaut

public class nomdu classe(){}

constructeur par initialisation


public class nomclasse (type attribut)
{
this.nomattribut=nom attribut;
}
getters
public type get nom(){
return nom;
}
setters
public void set nom(type nom){
this.nom=nom;}
creation et declaration tableau
private type tab[] ;
public type tab[];
ou
type tab =new type [] ;
exmple

public class tableau {


private int tab[] ;
public tableau (int n) {
this.n=n;
tab=new int [10];

ajout tableau
public void ajouterr( isem tableau a)
{
int i=0;
if(i<=tab.length)
{ tab[i]= a;
i++;}

ToString
public string TOSTRING(){
if( ){
return "messages ksh tehbou "}
else {
return"message ekher";}}
creation objet
personne a1= new personne("bla");

Vous aimerez peut-être aussi