Name: Jiasong Wu Consider the following code fragment taken from a package: public class Wisconsin extends State { Wisconsin() {/*null constructor*/} public void printMe () {System.out.println("Read it.");} public static void main(String[] args) { Region mid = new State(); State wi = new Wisconsin(); Object obj = new Place(); Place usa = new Region(); wi.printMe(); mid.printMe(); ((Place) obj).printMe(); obj = wi; ((Wisconsin) obj).printMe(); obj = usa; ((Place) obj).printMe(); usa = wi; ((Place) usa).printMe(); } } class State extends Region { State(){} public void printMe () {System.out.println("Ship it."); } } class Region extends Place{ Region(){} public void printMe () {System.out.println("Box it.");} } class Place extends Object{ Place(){} public void printMe () {System.out.println("Buy it.");} } What is the output from calling the method of the Wisconsin class?
Added by Gonzalo U.
Close
Step 1
The main method is the entry point of the program. Show more…
Show all steps
Your feedback will help us improve your experience
Shashank Pandey and 74 other AP CS educators are ready to help you.
Ask a new question
Labs
Want to see this concept in action?
Explore this concept interactively to see how it behaves as you change inputs.
Key Concepts
Recommended Videos
Consider the following code fragment, taken from some package: What is the output from calling the main() method of the Maryland class?
A. Write a class Sphere with the following properties: Private attributes: X, Y, Z coordinates of the center Radius Accessor and mutator methods to set and get the X, Y, and Z coordinates Set and get the radius Get the volume and surface area of a sphere For a sphere, volume = (4/3)Πr^3 surface area = 4Πr^2 Write a SphereTester class to test the Sphere class
Akash M.
Modify the CreditCard class from Code Fragment 1.5 so that printSummary becomes a nonstatic method, and modify the main method from Code Fragment 1.6 accordingly.
Recommended Textbooks
Computer Science and Information Technology
Introduction to Programming Using Python
Computer Science - An Overview
18,000,000+
Students on Numerade
Trusted by students at 8,000+ universities
Watch the video solution with this free unlock.
EMAIL
PASSWORD