Skip to content

Instantly share code, notes, and snippets.

@Rahandi
Last active October 12, 2017 18:00
Show Gist options
  • Save Rahandi/3f2ccb6fc21cefa5e58abe7286950382 to your computer and use it in GitHub Desktop.
Save Rahandi/3f2ccb6fc21cefa5e58abe7286950382 to your computer and use it in GitHub Desktop.
Circle
public class Circle {
private double radius;
private String color;
public Circle(){
radius = 1.0;
color = "merah";
}
public Circle(double r){
radius = r;
color = "merah";
}
public Circle(double r, String c){
radius = r;
color = c;
}
void printing(){
System.out.println("radius = " + radius);
System.out.println("color = " + color);
}
}
public class Tester {
public static void main(String[] args){
Circle polos = new Circle();
Circle radius = new Circle(0.5);
Circle lengkap = new Circle(1.5, "biru");
polos.printing();
radius.printing();
lengkap.printing();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment