+ 1

Why we don't have goto in java?

I had heard goto is very bad and you shouldn't use goto.I don't understand why?? I had used goto in my small many C and C++ programs. is it bad to use goto?? and why java don't have goto ??

23rd Nov 2017, 3:20 PM
SmitTheLinuxUser
SmitTheLinuxUser - avatar
4 Réponses
+ 2
James Gosling said that it isn't in Java because it's unnecessary, and usually it can be replaced with other statements which are more readable (break or continue). In my and some other's opinion, it can be the most readable way sometimes, but I'm not someone who disigns languages. :D There are several different opinions about this, you can read about these on Wikipedia: https://en.wikipedia.org/wiki/Goto
23rd Nov 2017, 3:40 PM
Péter Grósz
Péter Grósz - avatar
+ 1
I think Java has more advanced features then "goto" and that's true
23rd Nov 2017, 3:44 PM
Iwin Clint
Iwin Clint - avatar