Java code. I want to display the print at a format as 00:00:00.
The answer to this question is as follows:
The code is as follows:
public class MyClass {
public static void main(String args[]) {
//I am considering the hour1,minute1,second1 as 0
int hour1=0,minute1=0,second1=0;
System.out.printf("%02d:%02d:%02d", hour1, minute1, second1);
}
}
The input and output are provided in the screenshot below:
Get Answers For Free
Most questions answered within 1 hours.