Answers for "repeat java"

2

java repeat loop cycle for

for(int  i = 0; i < 10; i++) {
  	//your code
	if(random.nextInt(5) == 0) { i--; } //1 in 5 chance to repeat loop cycle
}
Posted by: Guest on November-18-2020
0

repeat string in java

public class Main 
{
    public static void main(String[] args) 
    {
        String str = "Abc";
 
        String repeated = new String(new char[3]).replace("\0", str);
 
        System.out.println(repeated);
    }
}
Posted by: Guest on May-08-2021

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language