Results 1 to 5 of 5

Thread: Jumping in java

  1. #1
    Kartiky14 is offline Member
    Join Date
    Mar 2012
    Posts
    10
    Rep Power
    0

    Default Jumping in java

    Are there jumping statements in JAVA?
    (Of any sort --- like label related jumping?? )

  2. #2
    j2me64's Avatar
    j2me64 is offline Senior Member
    Join Date
    Sep 2009
    Location
    Zurich, Switzerland
    Posts
    962
    Rep Power
    6

    Default Re: Jumping in java

    yes with the keywords break and continue. years of experience with basic have shown that GOTO should be handled carefully

  3. #3
    Kartiky14 is offline Member
    Join Date
    Mar 2012
    Posts
    10
    Rep Power
    0

    Default Re: Jumping in java

    Thank you!!
    but is this allowed-
    int i= 2;
    start :
    System.out.println(i);
    i+=2;
    if(i<51) goto start:
    I mean iteration without any looping construct ??

  4. #4
    ojn
    ojn is offline Senior Member
    Join Date
    Aug 2008
    Location
    Stockholm, Sweden
    Posts
    119
    Rep Power
    0

    Default Re: Jumping in java

    What happened when you tried it?

  5. #5
    j2me64's Avatar
    j2me64 is offline Senior Member
    Join Date
    Sep 2009
    Location
    Zurich, Switzerland
    Posts
    962
    Rep Power
    6

    Default Re: Jumping in java

    will not compile, goto is a keyword but is not used in java, so the compiler will not know what to do. for such problems you can use a while-, do-while or a for-loop.

Similar Threads

  1. Replies: 3
    Last Post: 08-10-2011, 09:17 AM
  2. Help with jumping
    By shadycharacter in forum New To Java
    Replies: 1
    Last Post: 04-14-2010, 09:04 PM
  3. How to stop thread from being jumping off the code without executing it.....
    By chiragkini in forum Threads and Synchronization
    Replies: 6
    Last Post: 01-22-2009, 03:38 AM
  4. Eclipse - jumping to method definition
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 11-07-2007, 02:52 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •