How to print a message to console without using main() function ? (do not use even static blocks also)



How to print a message to console without using main() function ? (do not use even static blocks also)

You could define a custom class loader that prints your message :

public class MyClassLoader extends ClassLoader {
    public MyClassLoader(ClassLoader other) {
         super(other);
         System.out.println("Hi there");
         System.exit(0);
    }
}

Related Searches to How to print a message to console without using main() function ? do not use even static blocks also.