java 如何在Android中使用goto语句
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/5087607/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to use the goto statement in Android
提问by sam_k
How can I use goto
in Android?
我如何goto
在 Android 中使用?
采纳答案by maid450
Tha language used in Androidis Java, and there isn't any goto
by itself in Java.
Android 中使用的语言是Java,而goto
Java 本身没有任何语言。
You can use a labeled break
or other alternatives as described in an answer to Stack Overflow question Alternative to a goto statement in Java, but these constructs should be avoided as long as possible, as they produce really ugly and hard-to-maintain code.
您可以使用标记break
或其他替代方法,如Stack Overflow 问题替代 Java 中的 goto 语句的答案中所述,但应尽可能避免使用这些构造,因为它们会产生非常丑陋且难以维护的代码。
Just figure out how to design your code correctly, and you will never need goto
and such stuff ;-)
只要弄清楚如何正确设计你的代码,你就永远不需要goto
这些东西了 ;-)