Lab Assignment/Task Report
Only for course Teacher
Needs Developing Sufficient Above Total
Improvement Average Mark
Allocate mark & Percentage 25% 50% 75% 100%
Clarity
Content Quality
Spelling & Grammar
Organization and
Formatting
Total obtained mark
Comments
Semester: July-Dec 2025(2nd)
Student Name: Shihab uddin
Student ID:0022520005101030
Batch: 45 Section: A
Course Code: CSE 124 Course Name: Object Oriented Programming Lab
Course Teacher Name: Debabrata Mallick
Designation: Lecturer
Submission Date: 30/01/2026
Lab Task 4: Java Basic
Java Strings ALL
Java Math
Java Booleans
Java If...Else ALL
Java Switch
Java While Loop ALL
Java For Loop ALL
Java Break/Continue
Java Arrays ALL
This document explains Java basics with code understanding and expected output.
Code and output screenshots should be attached during submission.
Here I present the codes I run into vs code from W3 school.
Explaination : In this array when the cars[1] is typed then the output is TESLA. Cause
the array starts from 0 and in the 1 there is the TESLA.
Explaination : Used to determine and print the Length of the array.
Explaination : The code delivers the average age from different ages.
Explaination : A boolean expression evaluates to either true or false using comparison
operators like >, =.
Explaination : If my age is greater or is the same to votingAge then the output is true.
Otherwise false.
Explaination : A boolean variable can store only two values: true or false. It is mainly used for
decision-making.
Explaination : In this code, if the condition is true, then the output will run.
Explaination : The for loop will run until it reaches the condition 4.
Explaination : The nested if will print the value by skipping the value 2 and 4.
Explaination : The code shows the sum of the numbers given in the array.
Explaination : The output for the array changed after we stored a new name in that
variable.
Explaination : The string compares the variables and produces the output.
Explaination : If it is raining then the output will be bring an umbrella. The condition must
be true first.
Explaination : The code will run from 1 to 12 and will skip 4.
Explaination : The switch expression is evaluated once.
• The result is compared with each case value.
• If there is a match, the matching block of code runs.
• The break statement stops the switch after the matching case has run.
• The default statement runs if there is no match.
Explaination : The do while loop runs from 1 to 9 and the condition is less than 10.
Explaination : The code locates the number of the text “Locate”.
Explaination : The fruits name stored in the variable is printed in the sequence.
Explaination : The code runs number from 0 to 4 .
Explaination : If the doorcode is true then the if statement will run, otherwise the else
one will run.
Explaination : if the condition is true then the output will be shown.
Explaination : If the condition is true, the output will be shown.
Explaination : [Link](x, y) returns the larger value.
[Link](x, y) returns the smaller value.
[Link](x) returns the square root.
Explaination : Here if both the condition is true then the output written will be shown.
Explaination : Here the logical not operator is used. If the condition is not true then the
statement will be printed.
Explaination : If the condition is true then the condition will be seen, and the final output
will be shown.
Explaination: first checks the outer loop and then goes to the inner loop. And while the
condition is true then the output is shown.
Explaination : Prints the cars name while the array goes on.
Explaination : The for-each loop is simpler and more readable than a regular for loop, since
you don't need a counter (like i < [Link]). The following example prints all elements in the
cars array
Explaination : In this code a for loop inside another for loop is used to visit every element
Explaination : • toUpperCase() converts all characters of a string to uppercase.
• toLowerCase() converts all characters of a string to lowercase.
Explaination : Prints the array in a vector shape. In rows and columms.
Explaination : prints the output if the output is true:
Explaination : Determines if is old enough to vote or not.
Explaination : Prints the outer and inner till the condition is true.
Explaination : Prints the array in the cars[2].
Explaination : Adds one string with another.
Explaination : the code runs the code and makes the words in Uppercase and
Lowercase.
Explaination : Determines the length of the row and colums
Explaination : If the time is less then 18 then it’s Good day. If is not then Good evening.
Explaination : \” add a double quote.
Explaination : Adds one string variable with another.
Explaination : Calculates the length of the string.
Explaination : Determines the sum of 1 to 5.
Explaination : Matches the day number to the day name and prints it.
Explaination : Combines the string and int value in the output.
Explaination : In this code the = (equal) sign is used. So if the condition is true than the
output will be shown.
Exlaination : When the condition is true then the output will be the if statement,
otherwise the else one.
Explaination : In this code the code will run until the condition meets to 5.
Explaination : In this code, The while loop contidion is checked what we first declared. If
it is true then the code runs and every time it decrements by one.