小编hic*_*cks的帖子

乘以字符串

如果您有一个字符串,例如:

String = "Hello world";
Run Code Online (Sandbox Code Playgroud)

如何打印(n)次?

例如

System.out.print("Hello world" * 5);
Run Code Online (Sandbox Code Playgroud)

给出输出:

Hello world
Hello world
Hello world
Hello world
Hello world
Run Code Online (Sandbox Code Playgroud)

现在显然我不能像我一样将字符串乘以5.

我知道我必须将字符串转换为整数才能使用的东西吗?但是我该怎么做?

java string integer

2
推荐指数
1
解决办法
2万
查看次数

标签 统计

integer ×1

java ×1

string ×1