자바에서 프로그램을 작성하고 있는데 메인과 두 번째 클래스 (송장)가있는 클래스 (InvoiceTest)를 만들어야했습니다. InvoiceTest 클래스를 실행하면 Invoice 클래스에 메시지가 표시됩니다. 내가 무엇을 잘 모릅니다메인 클래스를 다른 클래스에 연결하기
Exception in thread "main" java.lang.ExceptionInInitializerError
at InvoiceTest.main(InvoiceTest.java:4)
Caused by: java.lang.RuntimeException: Uncompilable source code - constructor Invoice() is already defined in class Invoice
at Invoice.<clinit>(Invoice.java:20)
... 1 more
은, 제가 뭘 잘못 알고 그것을 해결하는 방법에 대한 제안 주시기 바랍니다 오류가 계속. 감사합니다
public class InvoiceTest{
public static void main(String [] args) {
Invoice invoiceObject = new Invoice();
invoiceObject.simpleMessage();
}
}
// This is the second class. I am using NetBeans so each class is in its own window.
public class Invoice {
public void simpleMessage() {
System.out.println("This is another class");
}
}
'생성자 송장? – nachokk
이것은 전체 코드입니까 ?? – nachokk
예, 지금 막 추가하기 시작했습니다. 디코딩이란 무엇을 의미합니까? – user2005617