publicclassTest01{publicstaticvoidmain(String[] args){Scanner scanner =newScanner(System.in);System.out.println("请输入三个整数");int a = scanner.nextInt();int b = scanner.nextInt();int c = scanner.nextInt();int max =0;if(a>b){
max = a;}else{
max = b;}if(max<c){
max = c;}System.out.println("max ="+ max);}}
方法二
publicclassTest0102{publicstaticvoidmain(String[] args){Scanner scanner =newScanner(System.in);System.out.println("请输入三个整数");int a = scanner.nextInt();int b = scanner.nextInt();int c = scanner.nextInt();int max =0;
max = a>b?a:b;if(max<c){
max = c;}System.out.println("max ="+ max);}}
方法三
publicclassTest0103{publicstaticvoidmain(String[] args){int max =0;Scanner scanner =newScanner(System.in);System.out.println("请输入三个整数");for(int i =0; i <3; i++){int temp = scanner.nextInt();if(0== i){
max = temp;continue;}if(temp > max)
max = temp;}System.out.println("max="+ max);}}