当前位置: 代码迷 >> Java相关 >> 请教一个java错误问题
  详细解决方案

请教一个java错误问题

热度:93   发布时间:2008-08-30 18:09:19.0
请教一个java错误问题
public class Test {
    void max( int a ,int b ) {
        System.out.println( a > b ? a : b );
    }
    
    void max( short a, short b ) {
        System.out.println("short");
        System.out.println( a > b ? a : b );    
    }
    
    void max( float a , float b ) {
        System.out.println( a > b ? a : b );
    }
    
    public static void main(String[] args) {
        Test t = new Test();
        t.max(3, 4);
        short a = 3;
        short b = 4;
        t.max(a, b);
    }
}

这是我写的代码
输出结果应该是
4
short
4
可是在我电脑上运行输出的结果是:result 33
就算是我改了数字那些输出的结果也是这个
我安装了新的JDK运行也是这样的结果
我朋友电脑上运行又可以显示正确答案
请问哪位知道这是为什么?
搜索更多相关的解决方案: java  

----------------解决方案--------------------------------------------------------
你用什么IDE?
貌似没有编译...
----------------解决方案--------------------------------------------------------
  相关解决方案