coderz.py

Keep Coding Keep Cheering!

Java Arrays

An array is a collection of variables of the same type that are referenced by a common name. Arrays consist of contiguous memory locations. The lowest address corresponds to the first element and the highest address to the last element. Need for Arrays: The primary reason for arrays’ existence is that they allow for the […]

May 7, 2022 | Java | No comments

Jump Statements

The jump statements unconditionally transfer program control within a function. Java has three statements that perform an unconditional branch: return break continue Of these, you may use return anywhere in the program, whereas break and continue are used inside the smallest enclosing like loops, etc. The break statement: A break statement skips the rest of […]

May 6, 2022 | Java | No comments

More about loops

Multiple initialization and update Expression: A for loop may contain multiple initialization and/or multiple update expression. Optional Expression: All the three expressions of the for loop are optional. Infinite Loop: An infinite loop is an endless loop which can be created by omitting the test-expression. Empty Loop: This is also known as a time delay […]

May 6, 2022 | Java | No comments

Iteration Statements(Loops)

The iteration statements allow a set of instructions to be performed repeatedly until a certain condition is fulfilled. The iteration statements are also called loops or looping statements. Java provides three kinds of loops: for loop, while loop, and do-while loop. All three loop constructs of Java repeat a set of statements as long as […]

May 4, 2022 | Java | No comments

The switch vs if-else

The switch and if-else both are selection statements, and they both let you select an alternative out of the given many alternatives by testing an expression. However, there are some differences in their operations. These are given below: switch if-else the switch can only test for equality if can evaluate a relational or logical expression […]

May 4, 2022 | Java | No comments

switch Statement

Java provides a multiple-branch selection statement known as a switch. This selection statement successively tests the value of an expression against a list of integer or character constants. When a match is found, the statements associated with that constant are executed. Syntax: The syntax of the switch statement is as follows: The expression is evaluated, […]

May 1, 2022 | Java | No comments

if-else ladder & nested if block

if-else ladder: The if-else-if ladder statement is used to test multiple conditions in Java. It’s used to test a single condition from a set of statements. When there are multiple conditions to execute, the if-else-if ladder makes the code easy to understand and work with. Syntax: If Else If Block data flow diagram: Example: Output: […]

April 30, 2022 | Java | No comments

Selection Statement

The selection statement allows choosing the set of instructions for execution depending upon an expression’s truth value. Java provides two types of selection statements – if and switch. In addition, the’:?’ (ternary operator) is also used. The selection statements are also called conditional statements or decision statements. The if statement is used to test particular […]

April 30, 2022 | Java | No comments

Type casting in Java

In Java, type casting is a method or process for manually and automatically converting one data type into another. The compiler performs the automatic conversion, while the programmer performs the manual conversion. In this section, we’ll go over typecasting and the various types with examples. Types of Type Casting There are two types of typecasting: […]

April 30, 2022 | Java | No comments

Operator Precedence & Associativity

Operator precedence determines the order in which the operators in an expression are evaluated. Associativity rules determine the grouping of operands and operators in an expression with more than one operator of the same precedence. Operators Precedence Associativity postfix increment and decrement ++ — left to right prefix increment and decrement, and unary ++ — […]

April 30, 2022 | Java | No comments

Advertisement