Skip to content

Instantly share code, notes, and snippets.

@vincentius15
Last active March 16, 2019 15:30
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 vincentius15/ec400337a5a7e95d959fdf24c1cbfde5 to your computer and use it in GitHub Desktop.
Save vincentius15/ec400337a5a7e95d959fdf24c1cbfde5 to your computer and use it in GitHub Desktop.
public class Square {
public int topLeftCoordinateX;
public int topLeftCoordinateY;
public int side;
}
public class AreaCalculator{
public double area(Object shape){
if (shape instanceof Square){
Square square = (Square) shape;
return Math.pow(square.side, 2);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment