Download as pdf or txt
Download as pdf or txt
You are on page 1of 5

Department of Electrical Engineering Military College of Signals NUST

Lab 02 – WRITING BASIC JAVA PROGRAMS


Objective:
Opening Eclipse IDE and writing Basic Java Programs

Eclipse

Steps to create new Java Project

Object Oriented Programming


Department of Electrical Engineering Military College of Signals NUST

After this create new package by following the steps in below screenshot.

Object Oriented Programming


Department of Electrical Engineering Military College of Signals NUST

After this create new class by following the steps given in below screenshot

Object Oriented Programming


Department of Electrical Engineering Military College of Signals NUST

Write class name and check public class, as shown below:

Write
Code here

Output Window

Object Oriented Programming


Department of Electrical Engineering Military College of Signals NUST

Lab Tasks:

1. Write Java program to print word HelloWorld!


2. Write Java program to sum 2 numbers. Initialize each of the two numbers within the
class.
3. Write Java program to sum 3 numbers. Take the three numbers from user using
Scanner class.
4. Create simple calculator that will do arithmetic operation based character (+,-,x and /)
entered by user.

Post Lab

1. What is an object and how do you allocate memory to it?


2. What is the difference between an argument and a parameter?
3. What are different types of access modifiers?
4. What is Unicode?

Object Oriented Programming

You might also like