Mahir Ahmed Mahir Ahmed - 1 year ago 55
Java Question

method is undefined for the Application


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 Source

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();