Skip to content

Instantly share code, notes, and snippets.

@rawaludin
Created February 12, 2013 01:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rawaludin/4759243 to your computer and use it in GitHub Desktop.
Save rawaludin/4759243 to your computer and use it in GitHub Desktop.
class Sepeda {
public int posisiGigi;
public int kecepatan;
public String merk;
Sepeda() {
this.posisiGigi = 3;
this.kecepatan = 20;
this.merk = "Polygon";
}
Sepeda(String merk, int kecepatan) {
this.merk = merk;
this.kecepatan = kecepatan;
}
public void tambahKecepatan() {
this.kecepatan = this.kecepatan+1;
}
public void cetakKecepatan() {
System.out.println("Current speed "+this.kecepatan+" km/s");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment