Can i declare my own statement like goto in java | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Can i declare my own statement like goto in java

I really use goto a lot in c/c++ . but it is not available in java.so is there any way of declaring my own user define statement like user define functions?? if yes then how??

23rd Nov 2017, 3:47 PM
SmitTheLinuxUser
SmitTheLinuxUser - avatar
1 Answer
+ 7
You can't. gotos do exist in Java but they do 100% nothing. Try writing goto in code playground and the color would be purple which means its a statement. But it will cause an error since it does absolutely nothing. Just like the const keyword. btw goto leads to spaghetti code.
23rd Nov 2017, 4:02 PM
qwerty
qwerty - avatar