Connect with us

Hi, what are you looking for?

Control Structers In Java
Control Structers In Java

Programming

Control Structers In Java

In this tutorial, we going to look at the control structures in Java programming, this tutorial consists of a conditional statement and for, while loop statements.

Control Structures In Java

We will first look at loop expressions, these are the units that enable the program to produce different outputs. After that, we going to create conditional statements.

a = 1;
while(10 > s)
{
   a++;
   System.out.println(a);
}

In the example above, as long as a is less than 10, a will print and increase on the screen, when a is 10 the loop will end and the program will finish.

for(a = 10; a > 100; a++) 
{
   System.out.println(a);
}

In the code block here, the number a is assigned as 10, and if the condition a is less than 100, then 1 value is added to the loop when each loop is started, you can change it, and then the loop is terminated when the condition part is false.

for(int i in 10)
{
   System.out.println(i);
}

The above code block is for each block. With this loop, you can navigate within a string or set a loop according to the value you assign without specifying a limit. The “in” statement indicates that the left value is inside the right value, and the loop continues.

if(condition)
{
   // Code
}
else if(condition)
{
   // Code
}
else
{
   // Code
}

In the above structure, there is a code block that produces different outputs according to the condition. With this code block, you can produce different results depending on the situation.

CONGRATULATIONS YOU FINISHED CONTROL STRUCTURES IN JAVA!

Click to comment

Leave a Reply

Your email address will not be published. Required fields are marked *

You May Also Like

Programming

clean code is essential for updating scripts, adding new features to code, etc. So every developer, must learn how to clean the code. With...

Daily News

Cloud computing is a system that is often heard today and that most developers use at least once. In this article, we’ll look at...

Game Development

Visual Studio Code without a doubt, most popular and loved code editor in the code editor market. Many developers love working with Vs Code....

Daily News

GitHub Copilot was introduced last year and continues to make it easier for developers with nice updates to date. Although most people see Github...