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

What is the access scope of protected access specifier?

1002


What is Hierarchy of exception?

1090


Explain inner classes ?

1134


Is main an identifier?

1017


What is static data type in java?

1038


Explain the concept of proper inheritance?

1068


What do you mean by aggregation?

1326


Why we use protected in java?

983


What are the different types of constructor?

996


What is a function in programming?

1049


What is the difference between stringbuffer and stringbuilder class?

1114


Difference between static synchronization vs. Instance synchronization?

1131


When should I use singleton pattern?

1042


What do you mean by buffering?

1048


What methodology can be employed to locate substrings inside a string?

959