Mahir Ahmed Mahir Ahmed - 7 months ago 13
Java Question

method is undefined for the Application

import java.io.FileNotFoundException;

public class Application {

// Making an application that runs a new test
public static void main(String[] args) throws FileNotFoundException {

Test test = new Test();

ReservationSystemWindow reservationSystemWindow = ReservationSystemWindow();

}

}


this is my application class, the error is when creating the instance of this class

Answer

You are missing the new keyword needed to create a new instance. It is currently trying to call a undefined method named ReservationSystemWindow.

ReservationSystemWindow window = new ReservationSystemWindow();

or (not recommended, but it'll fix the problem)

You could define a method with the name of ReservationSystemWindow() in the Application class that returns an instance ReservationSystemWindow

public static ReservationSystemWindow ReservationSystemWindow() {
    return new ReservationSystemWindow();
}
Comments