Jump statements in Java -break continue goto return II Core Java II Automation II Selenium with Java

preview_player
Показать описание
In this session you will learn about Jump statements in java
You will learn how to use below keywords break;continue;goto; return;

Control Statements : Jump
========================
break -: Applied in Loops, conditional and when applied, breaks the loop.... ( Switch )
Synatax:
break;

Continue -: Applied in loops, conditional and when applied, the statements below continue are not executed and continues with the next iteration
syntax:
continue;

goto - break label;
continue label;
goto is used when program needs to jump to particular point of code

return
-: Returns are used in methods/functions to return a value
syntax:
return a+b;
return;

Examples for Practice:
===========================
package controlstatements;

public class jump_statements_Examples
{

public static void main(String args[])
{

jump_statements_Examples j=new jump_statements_Examples();


//int a=7;



/*
*
*/
// Break Examnple
/*
*/

/*
* // Continue; Example ( Printing odd numbers for (int i=0;iLT=10;i++) {
*
*/
//
// Example of goto
// continue label;
// break label;

/*
*
* out; } } }
*/

//Return Examples'

}

int sum(int x,int y)
{
return x+y;
}

void display()
{
return;
}


}
Рекомендации по теме
join shbcf.ru