There are three kinds of control structures:
Conditional Branches, which we use for choosing between two or more paths. There are three types in Java: if/else/else if, ternary operator and switch. Loops that are used to iterate through multiple values/objects and repeatedly run specific code blocks.
There are three kinds of control structures:
Conditional Branches, which we use for choosing between two or more paths. There are three types in Java: if/else/else if, ternary operator and switch. Loops that are used to iterate through multiple values/objects and repeatedly run specific code blocks.
If/Else/Else If
The if/else statement is the most basic of control structures, but can also be considered the very basis of decision making in programming. While if can be … Ternary Operator
We can use a ternary operator as a shorthand expression that works like an if/elsestatement. Let’s see our if/elseexample again: We can refactor this wit… Switch
If we have multiple cases to choose from, we can use a switch statement. Let’s again see a simple example: Three or more if/else statements can b… Loops
We use loopswhen we need to repeat the same code multiple times in succession. Let’s see a quick example of comparable for and whiletype of loops: Both c… Break
We need to use breakto exit early from a loop. Let’s see a quick example: Here, we are looking for a name in a list of names, and we want to stop lo… Continue
Simply put, continue means to skip the rest of the loop we’re in: Here, we skip appending the duplicate names into the list. As we’ve seen here, break and con… Conclusion
In this quick article, we learned what control structures are and how to use them to manage flow control in our Java programs. All code presented in this article i…
Distribution format for Java code and resources
The Java Platform Module System specifies a distribution format for collections of Java code and associated resources.
It also specifies a repository for storing these collections, or modules, and identifies how they can be discovered, loaded and checked for integrity.
It includes features such as namespaces with the aim of fixing some of the shortcomings in the existing JAR format, especially the JAR Hell, which can lead to issues such as classpath and class loading problems.