你好世界,
public class HelloWorld { public static void main(String []args) { System.out.println("hello! world"); } }
三个数比大小,java初试
import java.util.Scanner; public class Max { public static void main(String []args) { Scanner sc= new Scanner(System.in); System.out.println("please input the first int num"); int num1=sc.nextInt(); System.out.println("please input the second int num"); int num2=sc.nextInt(); System.out.println("please input the three int num"); int num3=sc.nextInt(); int max=num1; if(max<num2) { max=num2; } if(max<num3) { max=num3; } System.out.println("max("+num1+","+num2+","+num3+")"+"="+max);
9*9 乘法表 java乘法表
public class multtable { public static void main (String []args) { for(int i=1;i<=9;i++) { for(int j=1;j<=i;j++) { System.out.print(j+"*"+i+"="+j*i+" "); } System.out.println(); } } }