Posted by Aldian on Sun 5 Jul 22:44
report abuse | View followups from Bryan | download | new post
- public class VaisseauSpatial {
- String nom = null;
- String couleur="bleu";
- int nombre_de_canons=3;
- int vitesse=0;
- static int nombre_vaisseaux=0;
- nombre_vaisseaux++;
- this.nom=nom;
- }
- this(nom);
- this.couleur = couleur;
- this.nombre_de_canons = nombre_de_canons;
- }
- void accelerer(){
- vitesse++ ;
- " accélère et sa vitesse passe à: "+vitesse);
- }
- void ralentir(){
- vitesse-- ;
- if(vitesse<0)
- vitesse=0;
- " déccélère et sa vitesse passe à: "+vitesse);
- }
- VaisseauSpatial vaisseau1 = new VaisseauSpatial("Liberty");
- VaisseauSpatial vaisseau2 = new VaisseauSpatial("Emeraude","rouge",8);
- vaisseau1.accelerer();
- vaisseau2.accelerer();
- vaisseau1.ralentir();
- " vaisseaux dans l'espace");
- }
- }
Submit a correction or amendment below (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.