错误:无法在 intelliJ IDE 中找到或加载主类
2022-08-31 05:54:59
我是Java的初学者,我正在尝试使用IntelliJ运行我的代码,我刚刚将其作为JDK 1.7的IDE安装。下面的代码段keep甚至无法编译,并不断给我错误:
Error: Could not find or load main class libTest
法典
import java.lang.Integer;
import java.lang.String;
import java.lang.System;
import java.util.*;
class book {
private String name = "trial";
private int bookCode=1;
private int issued=0;
public void Issue(){
if(issued==0) {
issued=1;
System.out.println("You have succesfully issued the book");
}
else {
System.out.println("The book is already issued. Please contact the librarian for further details");
}
}
public int checkCode() {
return bookCode;
}
String readName() {
return name;
}
public void setName(String newName){
name=newName;
}
public void setBookCode(int newCode){
bookCode=newCode;
}
}
class library {
private ArrayList books=new ArrayList();
public void getList(){
for(int bk:books){
String bName=books(bk).readName();
System.out.println((bk+1)+") "+bName);
}
}
}
public class libTest{
public static void main(String[] args){
library newLib= new library();
System.out.println("code working");
}
}
我必须在编译器设置中进行任何更改吗?还是代码。