1020/30
三元运算符
idea生成javadoc
public class ScannerTest { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); System.out.println("请输入内容:"); if(scanner.hasNextLine()){ String str=scanner.nextLine(); System.out.println("输入的内容是:"+str); } scanner.close(); } }
package com.rv.java; /** * @author rv * @create 2021-05-11 19:56 */ public class KongSanJiao { public static void main(String[] args) { for (int i = 1; i <=5 ; i++) { for (int j = 1; j <=5-i ; j++) { System.out.print(" "); } System.out.print("*"); for (int l = 2; l <=i ; l++) { System.out.print(" "); } for (int l = 3; l <=i ; l++) { System.out.print(" "); } if(i==1) System.out.print(" "); else System.out.print("*"); // for (int k = 1; k <i ; k++) { // System.out.print(" "); // System.out.print("*"); // } System.out.println(); } }
}