第1题
package chapter01;
/**
* Java_Programming
*
* (显示3条信息)编写程序,显示 Welcome to Java、Welcome to Computer Science和 Programming is fun
* @author 羿禾
* @Create 2022-07-13 20:46
*/
public class Test1 {
public static void main(String[] args) {
System.out.println("Welcome to Java");
System.out.println("Welcome to Computer Science");
System.out.println("Programming is fun");
}
}
第2题
package chapter01;
/**
* Java_Programming
*
* (显示5条信息)编写程序,显示Welcome to Java 五次
* @author 羿禾
* @Create 2022-07-13 20:50
*/
public class Test02 {
public static void main(String[] args) {
for (int i = 0; i < 5; i++) {
System.out.println("Welcome to Java");
}
}
}
第3题
package chapter01;
/**
* Java_Programming
* (显示图案)编写程序,显示下面的图案
* J A V V A
* J A A V V A A
* J J AAAAA V V AAAAA
* J J A A V A A
* @author 羿禾
* @Create 2022-07-13 20:52
*/
public class Test03 {
public static void main(String[] args) {
for (int i = 0; i < 4; i++) {
switch (i) {
case 0 -> System.out.println(" J A V V A");
case 1 -> System.out.println(" J A A V V A A");
case 2 -> System.out.println("J J AAAAA V V AAAAA");
case 3 -> System.out.println(" J J A A V A A");
default -> {
}
}
}
}
}
第4题
package chapter01;
/**
* Java_Programming
* (打印表格)编写程序,显示以下表格
* a a^2 a^3
* 1 1 1
* 2 4 8
* 3