Shreyas arya

Generation

generate functionWed, 08 Feb 2023

Print string "Shreyas" and wait for 10 seconds. The total duration between 3 attempts doesn't exceed 10 seconds.

public void print_name(int delay) throws InterruptedException { for (int i = 0; i < 3; i++) { System.out.print("Shreyas"); Thread.sleep(delay * 1000); } } void run() throws InterruptedException { print_name(10); print_name(3); }

Questions about programming?Chat with your personal AI assistant