0
package Akash;
public class hell
{
    public static long toMilesPerHour (double kilometersPerHour) {

        if (kilometersPerHour < 0) {
            return -1;
        }
        else {
            long milesPerHour = Math.round(kilometersPerHour / 1.609);
            return milesPerHour;
        }
    }

    public static void printConversion (double kilometersPerHour) {

        if (kilometersPerHour < 0) {
            System.out.println("Invalid Value");
        }
        else {
            long miles = toMilesPerHour(kilometersPerHour);
            System.out.println(kilometersPerHour + " km/h = " + miles + " mi/h");
        }
    }
}

Error: Main method not found in class Akash.hell, please define the main method as: public static void main(String[] args) or a JavaFX application class must extend javafx.application.Application

Lukasz Blasiak
  • 390
  • 1
  • 6
  • 14

2 Answers2

1

The answer on your question is in error message. You have to define main method, which is entry point of your application:

public static void main(String[] args) {
    // invoke your static methods from here or create some new object and invoke its method
}

Are you familiar with java basics? You can learn more about main method here: Java main method.

Lukasz Blasiak
  • 390
  • 1
  • 6
  • 14
1

Main method is missing in your program, it should look like this

public class Cash{
    
    public static void main(String[] args) {
        Hell.printConversion(10);
    }
}
Doctor Who
  • 651
  • 1
  • 4
  • 16