do-while: Check the condition after execution of a block and continue with execution depends on the validity of condition. Block execute at least once though the condition is false for the first time. Syntax: Flow-Chart: …
Nested while loop: Defining a while loop inside another loop. Inner loop executes only if outer loop conditions satisfies. Loop terminates only if outer loop condition fails. Analyze the code: We can process two dimensional …
While-loop: Used to execute a block of instructions repeatedly as long as the given condition is valid. Syntax: Flow-Chart: The code executes infinite times as condition always true: Compiler raises error when we try define …
Nested if block: Defining a block inside another block. Inner if block condition evaluates only if the outer condition is valid. It is not recommended to write many levels to avoid complexity. Syntax: Code program: …
if-else-if ladder: Used to defined multiple if blocks. One if block execution depend to another if block. All the conditions execute sequentially from top to bottom. A specific block execute only if the corresponding condition …
if – else block: Else block can be used to execute an optional logic when “if-condition” fails. Flow-Chart: Check the Number is Even or Not: Find the biggest of 2 numbers: Only first statement consider …
if – block: It is used to execute a block of instructions only if the specified condition is true. The conditional expression must be a boolean type. Flow-Chart: If the expression fails, block will not …
Control Statements: Statement is a line of code in java program. Every statement in java contains expressions. Expressions build with operands (variables), operators, values, method calls….. Statements execution can be either Sequential or Control. Sequential …
Operator: An operator is a symbol that performs an operation. An operator acts on some variables called operands to get the desired result. Java operators can be classified into Unary operators: Performs operation on a Single …
float type Size in bytes Limits float 4 ±3.40282347E+38F double 8 ±1.79769313486231570E+308 Note: By default the decimal type is double. Hence we cannot assign a value directly to double(higher) type variable. We can declare float …