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()函数中,或者放到其他的函数里面就可以了。
【推荐】还在用 ECharts 开发大屏?试试这款永久免费的开源 BI 工具!
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步