Good luck!!
A small leak can sink a Gigantic ship.>
SCJP 1.4, SCWCD 1.4 - Hints for you, Certified Scrum Master
Did a rm -R / to find out that I lost my entire Linux installation!
Raza Mohd wrote:you can extend the class and call main method .
That will solve you problem
Regards
Raza
Jothi Shankar Kumar wrote:You could pass command line arguments...
SCJP 1.4, SCWCD 1.4 - Hints for you, Certified Scrum Master
Did a rm -R / to find out that I lost my entire Linux installation!
Ernest Friedman-Hill wrote:Raza Mohd's answer would require that you invoke a different class from the command line, not this one, which I think is against the spirit of the question. Jothi Shankar Kumar's answer isn't an option. But Henry's answer is a good one, and likely the one the interviewer had in mind.
SCJP 1.4, SCWCD 1.4 - Hints for you, Certified Scrum Master
Did a rm -R / to find out that I lost my entire Linux installation!
Henry Wong wrote:
One option you can try is using a shutdown hook -- code to be executed upon JVM shutdown. Take a look at the Runtime class for more info.
Henry
Sandeep
Henry Wong wrote:
One option you can try is using a shutdown hook -- code to be executed upon JVM shutdown. Take a look at the Runtime class for more info.
Henry
SCJP 1.6 ,SCWCD 5
Jothi Shankar Kumar wrote:
Ernest Friedman-Hill wrote:Raza Mohd's answer would require that you invoke a different class from the command line, not this one, which I think is against the spirit of the question. Jothi Shankar Kumar's answer isn't an option. But Henry's answer is a good one, and likely the one the interviewer had in mind.
Why isn't it an option?
SCJP 1.6 ,SCWCD 5
Rohan kanade wrote:
Henry Wong wrote:
One option you can try is using a shutdown hook -- code to be executed upon JVM shutdown. Take a look at the Runtime class for more info.
Henry
Or you can do this.
or you can add a finalize() method and say "bye" in that. but then you will have to create a object and point it to null then call the Garbage collector, plus there is no guarantee that GC will be called in time.
If you feel like impressing the interviewers , then try using the Runtime.exec() methods to call the host operating system's echo command, just for fun.
She said she got a brazillian. I think owning people is wrong. That is how I learned ... tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
|