- 1

[Solved]Can we replace the "main" method in Java to some other name like "hello"?

Hi! Here's a perfect answer to this: https://stackoverflow.com/questions/10947464/in-java-can-public-static-void-main-be-renamed-or-refactored

4th Dec 2021, 2:33 PM
ltsRoy
ltsRoy - avatar
5 Respostas
+ 2
Im'ma Coder R "Can we replace main method with other name" You said perfect answer is here so I assumed you were saying "yes we can replace means we can run without main method" but see your shared link main method is still there. It means we can not run java program without main method. We are just creating duplicate method and calling in main method.
7th Dec 2021, 3:19 PM
A͢J
A͢J - avatar
+ 1
A͢J - S͟o͟l͟o͟H͟e͟l͟p͟e͟r͟ Hi, I didn't really get you "You are calling...." thats exactly what was told in the answer. Moreover there were many answers there so it depends which one you read. And I didn't get which guideline I dishonoured. Could you explain?
7th Dec 2021, 2:16 PM
ltsRoy
ltsRoy - avatar
+ 1
Im'ma Coder R You are asking question as well as giving self answer with question which is not as per SoloLearn guidelines.
7th Dec 2021, 3:22 PM
A͢J
A͢J - avatar
0
Im'ma Coder R That's not a perfect answer. You are calling boot method inside main method so in simple without main method you cannot. And please follow this guidelines: https://www.sololearn.com/discuss/1316935/?ref=app
4th Dec 2021, 2:46 PM
A͢J
A͢J - avatar
0
A͢J - S͟o͟l͟o͟H͟e͟l͟p͟e͟r͟ Ok, so you had misinterpreted my question. Anyways, yes I agree that this might look against the guidelines, actually after posting the question I also found an answer so thought would paste it here.
7th Dec 2021, 5:25 PM
ltsRoy
ltsRoy - avatar