Lab Report 1
Lab Report 1
Lab Report – 01
Course Code: CSC-384
Course Name: Programming In Java Lab
Submitted to:
Naeem Mia
Lecturer, Department of Computer Science and
Engineering.
Submitted by:
Name: Sabbir Hossain
ID: 22103119
Section: F
Semester: Spring -2024
Program: BCSE
Submission Date: 17-02-2024
Experiment :1
Objective: Program in Java is to provide a simple and basic example that
demonstrates the structure of a Java program and introduces beginners to the
syntax of the language. This program serves as a starting point for learning Java
programming and understanding key concepts.
Algorithm:
1) Class Declaration:
public class HelloWorld: This declares a class named HelloWorld. In Java, every
application must contain at least one class with a main method.
2) Main Method:
• public static void main (String[] args): This is the main entry point of the
program. It is the starting point of execution when you run the program.
• public: The main method is public and can be accessed by the Java runtime
system.
• static: The main method is declared as static so that it can be called without
creating an instance of the class.
• void: The main method does not return any value.
• main: This is the name of the method. It is the identifier that the Java
Virtual Machine (JVM) looks for when starting the program.
• String[] args: The main method takes an array of strings as parameters.
These are the command-line arguments that can be passed to the program.
• Print Statement: System.out.println("Hello, World!");: This statement prints
the string "Hello, World!" to the console. The System.out.println method is
used to output text to the standard output (console).
When you run this program, it will display "Hello, World!" on the console.
Code:
package my.java;
Output:
Experiment :2
Objective: Java is to create an interactive console-based application that
allows users to input their personal information (name, department, and ID) and
then displays the entered information.
Algorithm:
• It starts by declaring variables for the user's name, department, and ID.
• It prompts the user to enter their name, reads the input, and stores it in the
'name' variable.
• Similarly, it prompts for and reads the department and ID inputs.
• Finally, it displays the entered information in a formatted manner.
Code:
package my.java;
import java.util.*;
Output: