Java用一种方法:输出10次:hello word

import java.util.Scanner;

public class haohao {
        public static void main(String[] args) {
            printwrods();
        }
        public static void printwrods(){
            for (int i = 0; i < 10; i++) {
                System.out.println("hello word!");
            }
        }
    }

运行结果:

hello word!
hello word!
hello word!
hello word!
hello word!
hello word!
hello word!
hello word!
hello word!
hello word!

猜你喜欢

转载自blog.csdn.net/weixin_44015669/article/details/89499831