Java.. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Java..

Hey guys, wanted some help for an assignment Im working on and need some help for the equivalence of return 0 in C++ for Java, and so as for goto! Thank U and appreciate all the help I can get!

8th Jan 2019, 5:46 PM
Firew Fireyhun
Firew Fireyhun - avatar
1 Answer
0
In Java, return statements are used the same way as in c++. Or do you mean the return statement of the main method? In this case, it isn't needed as the main method in Java has void as return type. To pass an exit code use System.exit(). There is no goto in Java and in most high level languages, but you also shouldn't use goto in c++, because it is unessecarily complicated.
8th Jan 2019, 11:40 PM
Moritz Vogel
Moritz Vogel - avatar