what is the replacement for GOTO in java?
Answers were Sorted based on User's Feedback
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 |
How can an exception be thrown manually by a programmer?
Explain java coding standards for variables ?
What is a native method in java programming?
What do you understand by the term wrapper classes?
State the difference between creating string as new () and literal.
What's the access scope of protected access specifier?
What do you know about the garbage collector in java?
Which collection does not allow duplicates in java?
Why main function is static?
What is static data type in java?
JVM responsibility?
What is the default value of local and global variables?