Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 388
  • Last Modified:

goto

in C you could create labels and "goto"

e.g.

label: statement

...
...
...

goto label;


is there such a thing in java?

thanks
0
tedtheworkman
Asked:
tedtheworkman
1 Solution
 
ykaganovCommented:
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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now