Print a String 1000 Times Without Using Loop

package org.wesome.dsalgo;

public class PrintName {
    public static void printName(int counter) {
        int max = 1000;
        if (counter <= max) {
            System.out.println("wesome.org " + counter);
            counter++;
            printName(counter);
        }
    }
}
package org.wesome.dsalgo;

import org.junit.jupiter.api.Test;

import static org.wesome.dsalgo.PrintName.printName;

public class PrintNameTest {
    @Test
    void printNameTest() {
        int counter = 1;
        printName(counter);
    }
}
plugins {
    id 'java'
    id "io.freefair.lombok" version "6.2.0"
}

group = 'org.wesome'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = JavaVersion.VERSION_1_8

repositories {
    mavenCentral()
}
dependencies {
    testImplementation('org.junit.jupiter:junit-jupiter:5.6.2')
}

test {
    useJUnitPlatform()
}

 

follow us on