Question:
public class Test {
public static void main(String[]
args) {
System.out.println("Ram");
}
}
Modify the above code to get below output:
Hi
Ram
Bye
You shouldn’t modify main method.
Solution:
public class Test {
static
{
System.out.println("Hi");
main(null);
System.out.println("Bye");
System.exit(0);
}
public static void main(String[] args) {
System.out.println("Ram");
}
}
0 comments:
Post a Comment