+ 5

Can't I use int main() in java?

recently I observed using int main() with return 0 shows an error in Java

2nd Dec 2019, 12:57 PM
Aditya
Aditya - avatar
2 Answers
+ 3
in java it has to be void. the return in main() in other programming languages returns a value to check the status of the exit. in java you can use System.exit()
2nd Dec 2019, 1:04 PM
Bahha┣
Bahha┣ - avatar