Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Linux Archive
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 12-12-2007, 01:17 PM
Senior Member
 
Join Date: Nov 2007
Posts: 111
bugger is on a distinguished road
goto statement
Hi Gurus,

I want to transfer control using goto statement. I used this in C++ and in GWBasic to good affect. Please help me with the syntax of goto statement. There are no line numbers with lines of code, how can I just to required line?

Cheers.
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 12-12-2007, 03:19 PM
Senior Member
 
Join Date: Jun 2007
Location: Bali, ID
Posts: 102
wsaryada is on a distinguished road
It would be better if you can design your program so it not need to use a goto statement because it was considered not as a good practice in programming.

Although goto is a reserved word in Java it is not used in the Java language. But there is a label, an identifier that can be used in conjunction with the break or continue. The purpose of the label it to let an iteration to jump outside of the iteration, it is a bit like goto statement.

Code:
labelA: // some loop { continue labelA; }
__________________
Website:
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
- Blog:
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Bookmark Post in Technorati
Reply With Quote
  #3 (permalink)  
Old 12-12-2007, 05:47 PM
Senior Member
 
Join Date: Nov 2007
Posts: 111
bugger is on a distinguished road
Thanks a lot.
I think I should avoid it if it not a good programming practice.
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
there is no return statement gabriel New To Java 17 12-03-2008 06:55 PM
Switch Statement Help bluegreen7hi New To Java 6 02-06-2008 07:16 AM
Help with if statement carl New To Java 1 08-06-2007 09:53 AM
Statement or Prepared Statement ? paty Database 3 08-01-2007 06:45 PM
If Statement aDrizzle New To Java 4 07-08-2007 10:55 PM


All times are GMT +3. The time now is 04:44 AM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org