Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Hello just want to understand what is the meaning of the code that i have highlighted, like why ThreeD sh = (ThreeD) ss; has to

Hello just want to understand what is the meaning of the code that i have highlighted, like why ThreeD sh = (ThreeD) ss;

has to be in "(ThreeD)", like what is the code looking out for? Is there any other possible way i can code it? and also what does "(Shape ss)" mean exactly. Thank you!

image text in transcribed

//prints some detials of 3d object private static void process 3DShape (Shape ss) { ThreeD sh = (ThreeD) ss; String type =""; if(sh.toString().contains("Cube")) { } type = "Cube"; } else if(sh.toString().contains("Sphere")) { type = "Sphere"; } else { } type = "Tetrahedron"; System.out.println("I am a "+type+" shape"); System.out.println("-- .");

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Using Financial Accounting Information The Alternative to Debits and Credits

Authors: Gary A. Porter, Curtis L. Norton

7th Edition

978-0-538-4527, 0-538-45274-9, 978-1133161646

More Books

Students also viewed these Programming questions

Question

4 0 6 .

Answered: 1 week ago