I am trying to learn java, and I am at an impasse in mastering the applets. I teach by the book and there is such code in the example, but I’m confused by the HTML code (Ie, it is simply inserted into the multi-line comment block after imports) right in the Java code (This is exactly what is shown in the book)
import java.awt.*; import java.applet.*; `/* <applet code = "main" width = 100 height=100></applet> */` class Main extends Applet{ public void init(){ } public void start(){ } public void stop(){ } public void destroy(){ } public void paint(Graphics g){ g.drawString("Hello World", 10,10); } } But it does not work. An error is displayed:
Error: Main method not found in class MyPackage.Main, please define the main method as:
public static void main (String [] args) or a JavaFX application class must extend javafx.application.Application