Created
September 1, 2018 08:52
-
-
Save adammb86/1ee7bbda45df97a6500618f1ff6be4ec to your computer and use it in GitHub Desktop.
Jawaban dari Clean Code For Class
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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