pastebin - collaborative debugging

pastebin is a collaborative debugging tool allowing you to share and modify code snippets while chatting on IRC, IM or a message board.

This site is developed to XHTML and CSS2 W3C standards. If you see this paragraph, your browser does not support those standards and you need to upgrade. Visit WaSP for a variety of options.

aldiansblog private pastebin - collaborative debugging tool What's a private pastebin?


Posted by Aldian on Sun 5 Jul 22:44
report abuse | View followups from Bryan | download | new post

  1. public class VaisseauSpatial {
  2.        
  3.         String nom = null;
  4.         String couleur="bleu";
  5.         int nombre_de_canons=3;
  6.         int vitesse=0;
  7.        
  8.         static int nombre_vaisseaux=0;
  9.        
  10.         VaisseauSpatial(String nom){   
  11.                 nombre_vaisseaux++;
  12.                 this.nom=nom;
  13.         }
  14.        
  15.         VaisseauSpatial(String nom,String couleur, int nombre_de_canons){
  16.                 this(nom);
  17.                 this.couleur = couleur;
  18.                 this.nombre_de_canons = nombre_de_canons;
  19.                 }
  20.        
  21.         void accelerer(){
  22.                 vitesse++ ;
  23.                 System.out.println("le vaisseau "+nom+
  24.                                 " accélère et sa vitesse passe à: "+vitesse);
  25.         }
  26.        
  27.         void ralentir(){
  28.                 vitesse-- ;
  29.                 if(vitesse<0)
  30.                         vitesse=0;
  31.                 System.out.println("le vaisseau "+nom+
  32.                                 " déccélère et sa vitesse passe à: "+vitesse);
  33.         }
  34.        
  35.          public static void main(String[] args) {
  36.                  VaisseauSpatial vaisseau1 = new VaisseauSpatial("Liberty");
  37.                  VaisseauSpatial vaisseau2 = new VaisseauSpatial("Emeraude","rouge",8);
  38.                  
  39.                  vaisseau1.accelerer();
  40.                  vaisseau2.accelerer();
  41.                  vaisseau1.ralentir();
  42.                  
  43.                  System.out.println("Il y a actuellement "+nombre_vaisseaux+
  44.                                  " vaisseaux dans l'espace");
  45.         }
  46. }

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.

Syntax highlighting:

To highlight particular lines, prefix each line with @@


Remember me so that I can delete my post