Shreyas arya

Generation

generate functionThu, 09 Feb 2023

string = shreyas delay = 5 seconds Number of retries = 3 The total duration of all attempts doesn't exceed 10 seconds.

public class Retry { public static void main(String[] args) { int retries = 3; int delay = 5; String string = "shreyas"; System.out.println(string); while (retries > 0) { try { Thread.sleep(delay * 1000); } catch (InterruptedException e) { e.printStackTrace(); } System.out.println(string); retries--; } } }

Questions about programming?Chat with your personal AI assistant