我是Java的初学者,正在尝试使用IntelliJ运行我的代码,而IntelliJ是作为我的IDE与JDK 1.7一起安装的。下面的代码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");
}
}
我必须在编译器设置中进行任何更改吗?还是代码。
import java.lang...
lang
包中的类会自动发生这种情况。
libTest.java
吗