Ich bin ein Anfänger in Java und versuche meinen Code mit Intellij auszuführen, das ich gerade als meine IDE mit JDK 1.7 installiert habe. Das folgende Stück Code -Halten kompiliert nicht einmal und gibt mir immer wieder den Fehler: < /p>
Error: Could not find or load main class libTest
< /code>
Code < /h2>
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");
}
}
< /code>
Gibt es eine Änderung, die ich in den Compiler -Einstellungen vornehmen muss? Oder ist es der Code.
Fehler: Die Hauptklasse in der Intellij IDE konnte oder laden Sie nicht ⇐ Java
-
- Similar Topics
- Replies
- Views
- Last post