control not parsing to main in javafx program

I’m new to java .The below onButtonClick() method which i have written for action listener was always executing the statement in else block.I need it to validate the username and password and execute the if-else block. Strangely when i have added some println’s in each method i have noticed that the control not parsing to main at all. the print statement in start method is executing first as soon as i started the program instead the first print statement in main. And both print statements in main were not at all getting executed.

import javafx.application.Application;
import javafx.geometry.Pos;
import javafx.scene.Scene;
import javafx.scene.control.PasswordField;
import javafx.scene.control.TextField;
import javafx.scene.layout.GridPane;
import javafx.scene.text.Font;
import javafx.scene.text.Text;
import javafx.stage.Stage;
import javafx.scene.control.Button;

    public class Version3 extends Application {
        public static void main(String args) {
            System.out.println("main called"); //this is not executing
            launch(args);
            System.out.println("Finished"); // this aswell
    }
    Button signInButton;
    Button cancelButton;
    Text userNameText;
    Text passwordText;
    Text Validation;
    TextField userNameField;
    PasswordField passwordField;
    //Using gridpane and intialized all Fields above

    public void start(Stage primaryStage) {
        System.out.println("Stage called"); 
   //added a statement to check when this method was calling. Statement 
   //getting executed as soon as the program started.

        GridPane pane = new GridPane();
        pane.setAlignment(Pos.CENTER);
        pane.setVgap(20);
        pane.setHgap(20);

        userNameText = new Text("Username");
        pane.add(userNameText, 0, 0);

        userNameField = new TextField();
        pane.add(userNameField, 1, 0);

        passwordText = new Text("Password");
        pane.add(passwordText, 0, 1);

        passwordField = new PasswordField();
        pane.add(passwordField, 1, 1);

        signInButton = new Button("Submit");
        pane.add(signInButton, 0, 2);

        signInButton.setOnAction(e -> onButtonClick());
        // calling method for signin button
        Validation = onButtonClick();
        pane.add(Validation, 0, 3);

        cancelButton = new Button("Clear");
        pane.add(cancelButton, 1, 2);

        Scene scene = new Scene(pane, 900, 600);

        primaryStage.setScene(scene);
        primaryStage.setTitle("The Click me app");
        primaryStage.show();

    }

    public Text onButtonClick() {
       System.out.println("onButton called");
       if (userNameField.getText().equals("admin") && 
       passwordField.getText().equals("password")) {
       Text val = new Text("Credentials Validated");
       //this is neither getting validated nor executing
       return val;
       } else {
       Text val = new Text("Invalid Credentials");
       // Always displaying this else block on layout
       return val;
       }
   }
}

args parameter in main method must be an array:

public static void main(String[] args) {

}
  1. first, your main method should be like this

    public static void main(String[] args){
        System.out.println("main called");
        launch(args);
        System.out.println("Finished");
    }
    
  2. second, change the statement in start(Stage primaryStage) method
    from

    Validation = onButtonClick();
    

    to

    Validation = new Text("Invalid Credentials");
    
  3. third, change the onButtonClick() method to

    public void onButtonClick(){
        System.out.println("onButton called");
        if(userNameField.getText().equals("admin") && passwordField.getText().equals("password")){
          Validation.setText("Credentials Validated");
        }else{
          Validation.setText("Invalid Credentials");
        } 
    }