Skip to content

Instantly share code, notes, and snippets.

@adammb86
Created September 1, 2018 08:52
Show Gist options
  • Save adammb86/1ee7bbda45df97a6500618f1ff6be4ec to your computer and use it in GitHub Desktop.
Save adammb86/1ee7bbda45df97a6500618f1ff6be4ec to your computer and use it in GitHub Desktop.
Jawaban dari Clean Code For Class
class Volume{
public static void main(String args[]){
Box b = new Box(5,5,5);
System.out.println(b.volume);
}
}
class Box {
public int volume;
Box(int length, int width, int height){
this.volume = length * width * height;
}
}
class Volume{
public static void main(String args[]){
Box b = new Box(5,5,5);
System.out.println(b.getVolume());
}
}
final class Box{
private int volume;
Box(int length, int width, int height){
this.volume = length * width * height;
}
public int getVolume(){
return volume;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment