IntelliJ IDEA编辑器的左上角File➡️Settings...➡️Build,Execution,Deployment➡️Compiler➡️java Compiler->Per-module bytecode Version 设置Target bytecode version的级别为匹配JDK。