question1.java
来自「java课程的资料以及实验的代码」· Java 代码 · 共 25 行
JAVA
25 行
class FindMax
{
public static void testMaxOfThree(int a,int b,int c)
{
int max; // stores the maximum number
max=(a>b)?a:b;
max=(max>c)?max:c;
System.out.println("The maximum number is:"+max);
};
public static void main(String args[])
{
int length=args.length;
if (length<3) // if the number of arguments is less than 3, exit
{
System.out.println("invalid number of arguments\n");
System.exit(1);
};
int a,b,c;
a=Integer.parseInt(args[0]);
b=Integer.parseInt(args[1]);
c=Integer.parseInt(args[2]); // obtain the three numbers
testMaxOfThree(a,b,c);
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?