Look at the code below and please help me solve the trick.
class TestTrick{
public static void main(String args[])
{
}
static marker()
{
System.out.println("programe executed");
}
}
The result required from this program is that the program should print
program executed, meaning that the marker method should be executed. But there are some rules:
- Nothing should be written in both the methods.
- No other class can be added to the program.
- The program must execute the output statement in the marker method.
It’s been three days and I am unable to solve the problem because I am not a Java programmer. I have searched everything on internet to get a clue but I failed. Please
someone help me run this program by strictly following the rules.
I think what they’re looking for is a static initializer.
This gets run when the class is loaded.