Java Bootcamp – Workbooks and Challenges
)}

Workbook 12.2

From the Java Bootcamp Resources, launch starter.

starter.png

Task 1

Create a constructor inside Shape that updates the radius of the current object.

Task 2

Create a constructor inside Cylinder that invokes the parent constructor and updates height.

Task 3

Create a constructor inside Sphere that invokes the parent constructor.

Task 4

Add this code to your main() method and feel free to visualize the runtime.

Cylinder cylinder = new Cylinder(1.0, 2.0); Sphere sphere = new Sphere(1.0); System.out.println("Sphere - radius: " + sphere.getRadius()); System.out.println("Cylinder - radius: " + cylinder.getRadius() + " height " + cylinder.getHeight());

Associated Course: The Complete Java Development Bootcamp
Related Course: The Complete Spring Boot Development Bootcamp – Become a Java Web Developer

Feedback Summary
4.7
43 students
5

91%
4

2%
3

0%
2

0%
1

7%
Written Reviews
There are no written reviews yet.