I am writing a program in java were I have to make a class (InvoiceTest) that will have main in it and a second class (Invoice). When I run the main InvoiceTest class it should show the message in the Invoice class. I keep getting an error
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
I dont know what to do, please let me know what I am doing wrong and any suggestions on how to fix it. Thanks
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");
}
}