Skip to content

Instantly share code, notes, and snippets.

@sugiartocokrowibowo
Created September 29, 2019 23:48
Show Gist options
  • Save sugiartocokrowibowo/95461e13167d1726488e327c8f2f4311 to your computer and use it in GitHub Desktop.
Save sugiartocokrowibowo/95461e13167d1726488e327c8f2f4311 to your computer and use it in GitHub Desktop.
public class LatihanClassObjectMethod003{
double panjang = 12;
double lebar = 7;
void cetakPanjang(){
System.out.println("Panjang Kotak: "+panjang);
}
void cetakLebar(){
System.out.println("Lebar Kotak: "+lebar);
}
double hitungLuas(){
double luas = panjang * lebar;
return luas;
}
void setPanjangLebar(double p, double l){
panjang = p;
lebar = l;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment