`
zhuobinzhou
  • 浏览: 136638 次
  • 性别: Icon_minigender_1
  • 来自: 广州
文章分类
社区版块
存档分类

loudly say I love you for many many times

J# 
阅读更多
import java.util.Random;

public class StringTest {
	public static void ini(String[] s){
		//为数组初始化
		for(int j = 0 ; j < s.length ; j ++){
			for(int i = 0 ; i < s.length ; i ++){
				s[i]= "I love you !" ;	
			}
		}
		for(int i = 1 ; i <= s.length ; i ++){
			System.out.println( i + " " + s[s.length - 1] + " @5201314 " );
		}	
	}
	public static void main(String args[]){
		Random ran = new Random();
		//创建一个长度不大于10的且随机的String类型的数组
		String[] s = new String[ran.nextInt(10)];
		System.out.println("I want to loudly say " + s.length + 
				" times " + "\" I love you @5201314 , Vividle ! \".");
		ini(s);
		
	}
	
}

 

效果:

I want to loudly say 8 times " I love you @5201314 , Vividle ! ".
1 I love you ! @5201314
2 I love you ! @5201314
3 I love you ! @5201314
4 I love you ! @5201314
5 I love you ! @5201314
6 I love you ! @5201314
7 I love you ! @5201314
8 I love you ! @5201314

 

说的次数是随机的,可以修改其上限值。

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics