1. 编写一个类的方法,其输入参数为一个整数,输出为该整数各个位上的最大数字。
import java.util.*;
public class Main {
public static int s(int num)
{
int max = 0;
while(num != 0)
{
if(num % 10 > max)
max = num % 10;
num /= 10;
}
return max;
}
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner x = new Scanner(System.in);
int i = x.nextInt();
System.out.print(s(i));
}
}