DCE501_Java_LabManual
DCE501_Java_LabManual
Branch
Diploma Computer Engineering
Semester: 5th
NOBLE UNIVERSITY
FACULTY OF ENGINEERING & TECHNOLOGY
DEPARTMENT OF COMPUTER ENGINEERING
Enrollment No. -
Student Name: -
INDEX
Sr. List of Experiments Date Grade Sign
No.
Practical set-1
1 Install JDK, write a simple Hello World java program,
compilation, debugging, executing using java compiler
and interpreter.
2 Write a program to find maximum number from 3 number
numbers using conditional operator.
Practical set-3
1 Write a program in Java to demonstrate single
inheritance.
Practical set-4
1 Write a program in Java to develop user defined
exception for 'Divide by Zero' error.
Practical set-5
1 Develop programs to create, write, modify, read
operations on Text files.
FACULTY OF ENGINEERING & TECHNOLOGY
DEPARTMENT OF CE/CSE/IT
Practical Set - 1
Practical-1
Aim: - Install JDK, write a simple Hello World java program, compilation, debugging,
executing using java compiler and interpreter.
Step 1: Go to the Oracle site and open the Java SE download page.
Under the latest version of Java Platform, Standard Edition, click on the JDK
download button
Step 2: Next,
1. Accept License Agreement
Download latest Java JDK for your version(32 or 64 bit) of java for Windows.
Download latest Java JDK for your version(32 or 64 bit) of java for Windows.
Step 3: Once the download is complete, run the exe for install JDK. Click Next
---
Step 6: Copy the path of bin folder which is installed in JDK folder.
Step 7: Paste Path of bin folder in Variable value and click on OK Button.
Note: In case you already have a PATH variable created in your PC, then paste your path
separated with a semi-comma (;), edit the PATH variable to
Here, %PATH% appends the existing path variable to our new value
Note: In case you java installation does not work after installation, change classpath to
class p1
{
public static void main(String s[])
{
System.out.println("Hello World!!");
}
}
Output: -
Practical-2
Aim: - Write a program to find maximum number from 3 number numbers using conditional
operator.
Practical-3
Aim: - Write a program to print 1 to 10 prints in descending (reverse)order using while loop.
Practical-4
Aim: - Write a program to find number is prime or not.
Practical-5
Aim: - Write a program to create 3 x 3 matrix using for loop.
Practical-6
Aim: - Write a program to add two 3 x 3 Matrix.
Practical-7
Aim: - Write a program to check number is odd or even.
Practical-8
Aim: - Write a program to print sum of 1 t o10 number using do while loop.
Practical-9
Aim: - Write a program to print following series using while loop 1 11 21 . . . 91
Practical-10
Aim: - Write a program to find factorial of 5.
Practical-11
Aim: - Develop a Java program to find maximum and minimum numbers from array
elements.
Practical Set - 2
Practical-1
Aim: - Develop a basic java program that demonstrates the use of Class & Object.
Part-1
Part-2
Practical-2
Aim: - Write a program in Java which has a class Rectangle having two instance variables
height and width. Initialize the class using constructor. Find out area of rectangle (R = l *b)
Practical-3
Aim: - Write a program in Java demonstrate the use of “this” keyword
Practical-4
Aim: - Write a program in Java to demonstrate the use of “static” keyword.
Practical-5
Aim: - Write a program in Java to demonstrate the use of "final" keyword.
Practical-6
Aim: - Write a program in Java which has a class Shape having 2 overloaded methods area
(float radius) and area (float length, float width). Display the area of circle and rectangle using
overloaded methods.
Practical-7
Aim: - Write a program in Java to demonstrate the constructor overloading.
Practical-8
Aim: - Write a program for the use of string class.
.
Practical-9
Aim: - Write a program in Java to demonstrate use of Scanner class.
Practical Set - 3
Practical-1
Aim: - Write a program in Java to demonstrate single inheritance.
Practical-2
Aim: - Write a program in Java to demonstrate multilevel inheritance.
Practical-3
Aim: - Write a program in Java to demonstrate hierarchical inheritance.
Practical-4
Aim: - Write a program in Java to demonstrate or a use of method overriding.
Practical-5
Aim: - Write a program in Java which has a class Car having two instance variables top Speed
and name. Override to String () method in Car class. Create 5 instances of Car class and print
the instances.
Practical-6
Aim: - Write a program in Java to implement multiple inheritance using interfaces.
Practical-7
Aim: - Write a program in Java which has an abstract class Shape having three subclasses:
Tr-iangle, Rectangle, and Circle. Define method area() in the abstract class Shape and
override area() method to calculate the area.
Practical-8
Aim: - Write a program in Java to demonstrate use of final class.
Practical-9
Aim: - Write a program in Java to demonstrate use of package.
Practical Set - 4
Practical-1
Aim: - Write a program in Java to develop user defined exception for 'Divide by Zero' error.
Practical-2
Aim: - Write a program in Java to develop user defined exception less than zero with user
define class.
Practical-3
Aim: - Write a program for the use of finally block.
Practical-4
Aim: - Write a program that executes two threads. One thread displays “Thread1” every 1000
milliseconds, and the other displays “Thread2” every 2000 milliseconds. Create the threads by
extending the Thread class
Practical Set - 5
Practical-1
Aim: - Develop programs to create, write, modify, read operations on Text files.