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

Can we override constructors?

997


Is it compulsory for a try block to be followed by a catch block in java for exception handling?

1008


What is int lol?

1136


What is the difference between the ">>" and " >>>" operators in java?

983


What are the parts of methodology?

972


What are the types of methodology?

1090


What is functional interface in java example?

983


What is a method in coding?

1051


What restrictions are placed on method overriding in java programming?

998


What are singleton services?

889


What is numel matlab?

1333


What is the use of accept () method in java?

1091


What is function and its uses?

1114


How to obtain a performance profile of java program

1028


What is the difference between exception and error in java?

1016