hour12) hour bour-12 hour- 12 lava statements th= define a variable sned window
ID: 3601374 • Letter: H
Question
hour12) hour bour-12 hour- 12 lava statements th= define a variable sned window oftype Square, bject and anigs to thaie The Square constructor has to integer then cr 2 write poe that an bject is stored at ndex 4·.collection. What will be ts index after objects at index 0 and index 9 are removed? 3 4 Consider the following Java program wich demonstrate the usage of ArrayList the code and answer the questions that folliow the code import java util ArrayList public class ArrayUsageExample public static void mainString args ArrayList String javaprog new ArrayList String?0 javaprog add"Dr.Ajol), javaprog add"Dr.Ajo2"), 14-Term Eurmaton.tfall 201Explanation / Answer
1)
In this code we are converting the time in 24 hours format into the 12 hours format
Int hour=hours.getValue();
From this line we will get the value of the hour
Next we are checking whether the hour is greater than 12 or not.
If yes we are subtracting 12 from the hour value.(By this we are converting into 12 line format).
If the hour is greater than 12 then assign “pm” to the suffix.
If the hour value is zero then we are assigning the value 12 .But we not manipulating the suffix(so suffix is “am” that mean time is 12 am)
And in the next statement we are display the time after converting into 12 hours format.
2)
//Creating a variable named window of type Square class
Square window;
/* Creating an Square class object by using parameterized
* constructor and assign it to the variable window
*/
window=new Square(4, 5);
3)
Ans) The index is 3
________________Thank YOu
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.