Java: Java Programming For Beginners a simple Start To Java Programming (Written By a software Engineer)


Download 0.82 Mb.
Pdf ko'rish
bet30/95
Sana09.01.2022
Hajmi0.82 Mb.
#261112
1   ...   26   27   28   29   30   31   32   33   ...   95
Bog'liq
Java Programming For Beginners - A Simple Start to Java Programming ( PDFDrive )

The Continue Keyword
The  proceed  with  decisive  word  can  be  utilized  as  a  part  of  any  of  the  loop  control
structures. It causes the loop to quickly bounce to the following emphasis of the loop.
In a for circle, the continue keyword reasons stream of control to quickly bounce to
the overhaul articulation.
In  a  while  or  do/while  loop,  stream  of  control  instantly  hops  to  the  Boolean
interpretation.
The syntax of using this keyword is as follows:
continue;
Sample Implementation:
public class myTest {
public static void main(String args[]) {
int [] mynumbers = {0, 5, 10, 15, 20};
for(int i : mynumbers ) {
if( i == 15 ) {
continue;
}
System.out.print( i );
System.out.print(“\n”);
}
}
}
The expected output of the code is:
0


5
10
20



Decision Making
There are two sorts of decision making constructs in Java. They are:
if constructs
switch constructs
The if Statement:
An if constructs comprises of a Boolean outflow emulated by one or more proclamations.
The syntax for using this construct is as follows:
if() {
//Statements if the condition is true
}
In the event that the Boolean construct assesses to true, then the scope of code inside the if
proclamation will be executed. If not the first set of code after the end of the if construct
(after the end wavy prop) will be executed.
Sample Implementation:
public class myTest {
public static void main(string args[]){
int i = 0;
if( i < 1 ){
System.out.print(“The if construct is executing!”);
}
}
This would create the accompanying result:
The if construct is executing!

Download 0.82 Mb.

Do'stlaringiz bilan baham:
1   ...   26   27   28   29   30   31   32   33   ...   95




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling