// * execute without main method Program *//
class Maind
{
static
{
System.out.println("Hello execute without main method.");
System.exit(0);
}
}
Compile : javac Maind.java
Run : java Maind
Output :-
Hello execute without main method.
______________________________________________{
static
{
System.out.println("Hello execute without main method.");
System.exit(0);
}
}
Compile : javac Maind.java
Run : java Maind
Output :-
Hello execute without main method.
// *....... execute without main method Program........... /
class Maind
{
static
{
System.out.println("Hello execute without main method.");
}
}
Compile : javac Maind.java
Run: java Maind
Output :-
Hello execute without main method.
Exception in thread "main" java.lang.NoSuchMethodError: main
No comments:
Post a Comment