?
Solved

goto

Posted on 2003-03-05
1
Medium Priority
?
378 Views
Last Modified: 2010-03-31
in C you could create labels and "goto"

e.g.

label: statement

...
...
...

goto label;


is there such a thing in java?

thanks
0
Comment
Question by:tedtheworkman
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 1

Accepted Solution

by:
ykaganov earned 150 total points
ID: 8074064
No! It's a reserved keyword, but it's not used in the language.

But there are labels in case you need to break out of a loop:

OUT: for (int ctr = 0; ctr < 5; ctr++ )
    {
      while (ctr2 < 50)
      {
        if (ctr * ctr2 == 300)
           break OUT;
         ...
      }
    }

See http://java.sun.com/docs/books/jls/second_edition/html/statements.doc.html#78993
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

INTRODUCTION Working with files is a moderately common task in Java.  For most projects hard coding the file names, using parameters in configuration files, or using command-line arguments is sufficient.   However, when your application has vi…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
Suggested Courses

800 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question