Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Whenever I try to compile my code, it says error: call to super must be first statement in constructor super(setTime) Can someone please help

Whenever I try to compile my code, it says "error: call to super must be first statement in constructor

super(setTime)" Can someone please help me with this, thank you!

public class CMilClock extends CClockType { private int milHours; private int milSec; public CMilClock() { this.milHours = 0; this.milSec = 0; } public CMilClock(int milHours, int milSec) { setTime(milHours, milSec); } public void setTime(int milHours, int milSec) { // TODO change the member variable values in base class and super class super(setTime); this.milHours = milHours; this.milSec = milSec; } public int getHour() { return this.milHours; } public int getStdHr() { return super.getHour(); } public void printTime(){ System.out.println(this.milHours + ":" + this.milSec); super.printTime(); } public static void main(String [] argv){ CMilClock myClock = new CMilClock(1230, 10); myClock.printTime(); CClockType youClock = new CMilClock(1230, 10); youClock.printTime(); } }

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

Spatial Databases A Tour

Authors: Shashi Shekhar, Sanjay Chawla

1st Edition

0130174807, 978-0130174802

More Books

Students also viewed these Databases questions

Question

Explain the concept of shear force and bending moment in beams.

Answered: 1 week ago

Question

Determine the roles of spatial layout and functionality.

Answered: 1 week ago