From 04f63a7dd1653aa39cbaa41f793a991a1bfd86ca Mon Sep 17 00:00:00 2001 From: Po Lu Date: Sat, 29 Mar 2025 22:37:39 +0800 Subject: [PATCH] ; * admin/notes/java: Document substitutes for `goto' in Java. (cherry picked from commit 04bd6497300789cd90b365299885517d92292648) --- admin/notes/java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/admin/notes/java b/admin/notes/java index 0bfdff339cb..9a7c925e123 100644 --- a/admin/notes/java +++ b/admin/notes/java @@ -452,6 +452,20 @@ on systems where shared object constructors are supported. See http://docs.oracle.com/en/java/javase/19/docs/specs/jni/intro.html for more details. +Java does not support `goto' statements, which it defines as reserved +identifiers but does not assign any syntatic role. If you are in a +position where you must exercise `goto' to exit a block prematurely, you +may define the block and exit it with a named `break' statement, thus: + + label: + { + int x, y = foo (); + + if (y) + break label; + x = something (); + } + OVERVIEW OF ANDROID -- 2.39.5