Scanner input = new Scanner(System.in); System.out.println("请输入一个数字"); int a=input.nextInt(); System.out.println("请输入一个字符串"); String b=input.next(); System.out.println(a); System.out.println(b); /*请输入一个数字2请输入一个字符串er2er*/
键入数据
关键字continue,break
continue:跳过本次循环
break:跳出循环
循环嵌套(99乘法表)
public class TestFor{ public static void main(String args[]){ for(int i=1;i<=9;i++){ for(int j=1;j<=i;j++){ System.out.print(i+" * "+j+" = "+i*j+" "); } System.out.println(); } } }
时间: 2024-11-07 16:14:08