Skip to content

Instantly share code, notes, and snippets.

@gdetrez
Created January 1, 2013 17:46
Show Gist options
  • Save gdetrez/4428913 to your computer and use it in GitHub Desktop.
Save gdetrez/4428913 to your computer and use it in GitHub Desktop.
class Main {
public static void main(String[] argv) {
Arme epee = new Arme(10, "Magic epee");
Arme fusil = new Arme(30, "fusil");
System.out.print("J'ai une ");
System.out.print(epee.name);
System.out.print(" de force ");
System.out.println(epee.force);
System.out.println(epee);
System.out.println(fusil);
}
}
class Arme {
int force;
String name;
public Arme(int force, String name) {
this.force = force;
this.name = name;
}
public String toString() {
return this.name + " <force=" + this.force + ">";
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment