Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

what is the replacement for GOTO in java?

Answer Posted / devesh dashora

break with label and continue with label.
1. Break with label
loop1: for (int i = 0; i < 10; i++)
{
loop2: for ( int j = 0; j < 10; j++)
{
System.out.println(i);
if( i + j > 10 )
break loop1;
}
}

2. continue with label

loop1: for (int i = 0; i < 10; i++)
{
loop2: for ( int j = 0; j < 10; j++)
{
if(i + j == 5)
continue loop1;
System.out.println(j);
}
}

Is This Answer Correct ?    12 Yes 20 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain the importance of thread scheduler in java?

950


What is an exception in java?

1058


What is thread safe java?

867


What if the main() method is declared as private? What happens when the static modifier is removed from the signature of the main() method?

1138


Why scanner is used in java?

1006


What is the use of pattern in java?

981


Explain an algorithm to find depth of a binary tree.

989


how to create multithreaded program? Explain different ways of using thread? When a thread is created and started, what is its initial state? : Java thread

954


What are the rules for naming an array?

987


What are the advantages of autoboxing?

974


What modifiers may be used with a top-level class?

998


What is the use of string and stringbuffer?

932


Convert Binary tree to linked list.

1009


What is time complexity java?

946


What isan abstract class and when do you use it?

1503