Java跳动爱心代码
时间: 2023-10-06 21:10:48 浏览: 265
java爱心代码跳动.md
Java跳动爱心代码如下:
```java
public class HeartAnimation {
public static void main(String[] args) throws InterruptedException {
String[] heart = {
" ** ** ",
"**** ****",
"****** ******",
" ************",
" **********",
" ********",
" ******",
" ****",
" **",
" *"
};
for (int i = 0; i < heart.length; i++) {
for (int j = 0; j < i; j++) {
System.out.print(" ");
}
System.out.println(heart[i]);
Thread.sleep(200);
}
}
}
```
阅读全文