1. 程式人生 > 其它 >【原創】記一次對X呼APP的滲透測試

【原創】記一次對X呼APP的滲透測試

package www.nihao;

public class demo03 {
    public static void main(String[] args) {
        double max=max(10.0,100.0);
        System.out.println(max);
    }
    //求最大數的方法
    public static int max(int x,int y)
    {
        int answer;
        if(x==y)
        {
            System.out.println("number1=number2");
            return 0;//有終止方法的作用
        }
        else if(x>y)
        {
            answer=x;
        }
        else
        {
            answer=y;
        }
        return answer;
    }
    public static double max(double x,double y)
    {
        double answer;
        if(x==y)
        {
            System.out.println("number1=number2");
            return 0;//有終止方法的作用
        }
        else if(x>y)
        {
            answer=x;
        }
        else
        {
            answer=y;
        }
        return answer;
    }

}

  相同的方法名,可以被改變引數個數和引數型別,完成不同的輸出,被叫為引數過載