Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Could someone help me? I need a Java statement that creates the objectmysteryClo

ID: 3608908 • Letter: C

Question

Could someone help me?
I need a Java statement that creates the objectmysteryClock of the clock type and initializes the instancevariable hr, min, and sec of mysteryClock to 7, 18, 39.
I think I understand how to create the object but I don'tquite follow how you initializes...
like Clock mysteryClock = new Clock(7, 18, 39) <---Would that be correct???
I need a Java statement that creates the objectmysteryClock of the clock type and initializes the instancevariable hr, min, and sec of mysteryClock to 7, 18, 39.
I think I understand how to create the object but I don'tquite follow how you initializes...
like Clock mysteryClock = new Clock(7, 18, 39) <---Would that be correct???

Explanation / Answer

Dear... mysteryClock is object of clock to initialize themembers of class clock we have two ways one is using constructorand other is direct initialization. Clock mysteryClock = new Clock(7, 18, 39)   this canbe done only if we have constructor in class clock whose code is asfollows:       clock(int m,int h,ints)                   {                            hr=h;                            min=m;                            sec=s;                   } Another way of initialization is mysteryClock.hr=7;                                                mysteryClock.min=18;                                               mysteryClock.sec=39; Hope this will helpyou...