can we execute any program without main in java? Explain it with the help of suitable program . code example
Example: Can we execute a program without main() method
Yes, one of the ways to execute the program without the main method is
using static block
What if the static modifier is removed from the signature of the main method??
Program compiles. However, at runtime, It throws an error "NoSuchMethodError