Exception in thread "main" java.lang.Error: Unresolved compilation problem:

package cn.itcast.day1;



//import static java.lang.Math.max;

//import static java.lang.Math.*;



public class StaticImport {

    public static void main(String[] args)

    {

        int x = 1;

        System.out.println("Hello world!");

        System.out.println(Math.max(3, 4));

        System.out.println(Math.abs(3 - 23));

    }

    

    System.out.println(Max(32, 4));  // 这句出现问题

}

编译出现如下错误:

Exception in thread "main" java.lang.Error: Unresolved compilation problem:

 at cn.itcast.day1.StaticImport.main(StaticImport.java:7)

原因是System.out.println(Max(32, 4));这句话有问题,把这句话放到main()函数中,或者放到其他的函数里面就可以了。

你可能感兴趣的:(exception)