Question: java code write a static method getRandomTime() that uses an instance of Random to generate a random time in hour and minutes. the hour must

java code

write a static method getRandomTime() that uses an instance of Random to generate a random time in hour and minutes. the hour must be between 1 and 12, both inclusive. the minute must between 0 and 59, both inclusive. the method should return a string of the form hour:minute, such as 12:19 or 1:6. you did not need to worry about pending hour or minute with leading zeros.

import java.util.Random;

public class someclass{

public static string getRandomTime{

}

}

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!