Category: Easy exercises

The following exercises are very easy and they are designed for beginners.

Java exercise 05: Conditional & operators

Here is a simple code using control statements and operators. To answer this quiz you need to understand how conditional statements work in combination with the following operators(&&, ||, <=, ! and <), which are used in the code. Java exercise 05: Conditional statements & opeators Level: Very easy What happens if the following code […]

Java exercise 04: How operators work?

Here is a simple code using operators. To answer this quiz you need to understand the following operators(<=, > and &&), which are used in the code. Java exercise 04: How operators work? Level: Very easy Author: Sar Maroof What happens if the following code is compiled and run? a. This program writes “5” to […]

Exercise 03: Default values of variables

If variables are not initialized, they have a standard value. For example, the value of uninitialized boolean variable is “false”, but a standard value of an integer variable is 0…etc. Java exercise 03: Default values of variables Level: Very easy What is written to the standard output as the result of executing the following code? […]

Exercise 02: Simple for loop

The following code demonstrates a simple Java for loop. The level of this serie exercises is very easy. They are all designed for beginners. Java exercise 02: A simple for loop Level: Very easy What happens if the following code is compiled and run? Author: Sar Maroof Answer explanation The statement for(int i = 0; […]

Exercise 01: Simple conditional statement

I started this easy Java exercises, because some members wrote to me that the easy quizzes, puzzles and assignments are not easy for them. Therefore, I realized that this serie might help the beginners even better. In this serie I keep the code as simple as I can. Java exercise 01: A simple conditional statement […]