Question: class ExtClock extends Clock { private String timeZone; public ExtClock() { setTime(0, 0, 0, unknown); } public ExtClock(int hours, int minutes, int seconds, String zone)

class ExtClock extends Clock { private String timeZone;

public ExtClock() { setTime(0, 0, 0, "unknown"); } public ExtClock(int hours, int minutes, int seconds, String zone) { super(hours, minutes, seconds); timeZone = zone; } public void setTime(int hours, int minutes, int seconds, String zone) { timeZone = zone; }

public void setTimeZone(String zone) { timeZone = zone; } public String getTimeZone() { return timeZone; } @Override public String toString() { return (super.toString() + " " + timeZone); } }//end of class

public class TestClock { public static void main(String[] args) { ExtClock clockOne = new ExtClock(7, 30, 22, "Mountain"); ExtClock clockTwo = new ExtClock(); ExtClock clockThree = new ExtClock(14, 7, 35, "Central"); ExtClock clockFour = new ExtClock(); System.out.println(clockOne); System.out.println(clockTwo); System.out.println(clockThree); System.out.println(clockFour); }//end of main }//end of class

can not get the time to print correctly i get

ExtClock@15db9742 Mountain ExtClock@6d06d69c unknown ExtClock@7852e922 Central ExtClock@4e25154f unknown

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!