The code below compiled successfully here https://www.compilejava.net/ but execution fails
Error: Could not find or load main class ClassDemo
whereas it does have a main entry point. Why ?
package com.tutorialspoint;
import java.lang.reflect.*;
public class ClassDemo {
   public static void main(String[] args) {
     try {            
        ClassDemo c = new ClassDemo();
        Class cls = c.getClass();
        // returns the array of Field objects
        Field[] fields = cls.getDeclaredFields();
        for(int i = 0; i < fields.length; i++) {
           System.out.println("Field = " + fields[i].toString());
        }
     }
     catch(Exception e) {
        System.out.println(e.toString());
     }
   }
   public ClassDemo() {
      // no argument constructor
   }
   public ClassDemo(long l, int i) {
      this.l = l;
      this.i = i;
   }
   long l = 77688;
   int i = 3;
}