package com.haitao;
import javax.swing.*;
public class Demo2 extends JFrame {
/*public Demo2()
{
this.setVisible(true);
this.setSize(400,400);
}
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
//Demo2 jf=new Demo2();
ABC a=new ABC();
System.out.println(a.getMax(10.2f, 20.2f));
}
}
class ABC
{
//返回较大的整数
public int getMax(int i ,int j)
{
if(i>=j){
return i ;
}
else {
return j;
}
}
//返回较大的浮点数
public float getMax(float m,float n)
{
if(m>=n){
return m;
}
else
{
return n;
}
}
}
java中的方法重载 overload
最新推荐文章于 2022-03-30 20:28:19 发布