Core java
- 27 April
Switch case in java
Switch case in java is alternative to if else if ladder. It is used to execute statements based on some conditions. Syntax of Switch case in java [crayon-67435ca6b90f7463453059/] Let’s understand it with the help of simple example. We are going to print weekday based on integer. 0 represents Sunday, 1 represents Monday and so on.. […]
- 27 April
if else statement in java
If else statements in java are used to test some conditions. It evaluates a condition to be true or false. There are three types of if statements. If statement If else statement If else if ladder statement Simple If statement [crayon-67435ca6b9587935406906/] For example: [crayon-67435ca6b958d423743882/] Output: Price is greater than 10 You can write single line followed […]
- 27 April
Comments in java code
Comments are the essential part of code. If you write good comments, it will be easier for others to understand the code. Comments are ignored by the compiler when it compiles the program. There are three types of comments in java code. Single line comments Multi-line comments Java doc comments Single line comments: These are […]
- 27 April
Do While Loop in Java with Example
1. Introduction In programming, controlling the flow of execution is essential for building functional and efficient applications. Java provides several control flow statements, and among these, the do-while loop offers a unique way to execute a block of code at least once and then repeat the execution based on a given condition. 2. The Syntax […]
- 13 April
Break Statement in Java
1. Introduction The break keyword in Java is primarily used in two contexts: within loops (for, while, and do-while) and in switch statements. Its main purpose is to terminate the loop or switch statement and transfer control to the statement immediately following the loop or switch. 2. Syntax The syntax of the break statement is […]
- 12 April
Continue Statement in Java
1. Introduction The continue statement in Java is used to skip the current iteration of a loop (for, while, or do-while) and proceed to the next iteration. When a continue statement is executed, the loop does not terminate. Instead, it immediately jumps to the next iteration, bypassing any code following the continue statement within the […]
- 05 April
While Loop in Java with Example
1. Introduction In programming, loops are fundamental constructs that allow us to execute a block of code repeatedly under certain conditions. Java provides various loop structures, and one of the simplest among them is the while loop. The while loop repeatedly executes a target statement as long as a given condition is true. A while […]
- 05 April
For Loop in Java With Example
1. Introduction There are several looping statements available in Java, one of which is the for loop. The for loop in Java is used to execute a set of statements repeatedly until a specified condition evaluates to false. It provides a compact way to initialize a loop variable, check a condition, and update the loop […]
- 18 March
Final keyword in java with example
In this post, we will see about final keyword in java. Final keyword can be associated with: variable method class Final is often used when you want restrict others from doing any changes. Let’s go through each by one. Final variable If you make any variable final then you are not allowed to change its […]