Java 计算打印字符串的次数

Java 计算打印字符串的次数,java,Java,我有一个for循环,可以多次打印字符串 我需要知道: 如何获取字符串的打印次数 谢谢 int count=0 int count = 0 for (int i = 0 ; i < stop_criteria; i++){ // print string count++; } printf("Number of times printed %d", count); 对于(int i=0;i

我有一个for循环,可以多次打印字符串

我需要知道:

如何获取字符串的打印次数

谢谢

int count=0
int count = 0

for (int i = 0 ; i < stop_criteria; i++){
    // print string
    count++;
}
printf("Number of times printed %d", count);
对于(int i=0;i
或者按照建议:

inti;
对于(i=0;i
使用计数器变量?请提供更多详细信息。这里几乎没有足够的信息。读取与迭代循环相同的次数。
int i;
for (i = 0 ; i < stop_criteria; i++){
    // print string
}

printf("Number of times printed %d", i);