Chapter 5- The for Loop in Java
For loop: The syntax of a for loop looks like this: /* for (initialize; check_bool_expression; update){ //code…
For loop: The syntax of a for loop looks like this: /* for (initialize; check_bool_expression; update){ //code…
do-while loop: This loop is similar to a while loop except for the fact that it is guaranteed to execute at least once /* do…
Sometimes we want our program to execute a few sets of instructions over and over again. For example : print 1 to 1000, prin…
Exercise 2 Create a simple Rock, Paper Scissors game in Java. (#Use Conditional Statements) package com.company; import java…
Chapter 4– Practice Set 1. What will be the output of this program: int a = 10; if (a=11) System.out.println(“I am 1…
Switch Case-Control Instruction Switch-Case is used when we have to make a choice between the number of alternatives for a g…
Relational Operators in Java Relational operators are used to evaluate conditions (true or false) inside the if statements. …
PDF View - View 1. // [comment] Single line comment 2. /* [comment] */ Multi line comment. 3. public This can be impor…
Sometimes we want to watch comedy videos on YouTube If the day is Sunday. Sometimes, we order junk food if it is our friend’…
Today we will solve some of the best problems in Java related to strings! Here is the Chapter 3 – Practice Set 1. Write a Ja…
String Methods operate on Java Strings. They can be used to find the length of the string, convert to lowercase, etc. Some o…
A string is a sequence of characters. A string is instantiated as follows: String name; name = new String(“Aryadeep”); …
Questions : 1. What will be the result of the following expression: float a = 7/4 * 9/2 2. Write a java program to encryp…
Resulting data type after arithmetic operation Result = byte + short => integer Result = short + integer => integer Re…
Associativity Associativity tells the direction of the execution of operators. It can either be left to right or vice versa.…
Operators are used to perform operations on variables and values. 7 + 11 = 18 ( Here, 7 and 11 are operand and "+&qu…
Chapter 1 – Practice Set Write a program to sum three numbers in Java. Write a program to calculate CGPA using marks of thre…
Exercise 1.1 Write a program to calculate the percentage of a given student in the CBSE board exam. His marks from 5 subject…
Reading data from the Keyboard In order to read data from the keyboard, Java has a scanner class . Scanner class has a lot …
Our website uses cookies to improve your experience. Learn more
Ok