0% found this document useful (0 votes)
5 views19 pages

Java Programming Practical Exercises

The document outlines a series of practical Java programming exercises, each with specific objectives such as accepting student details, finding maximum and minimum values in an array, creating a simple calculator, and implementing exception handling. It also covers concepts like inheritance, user-defined packages, threading, and database connectivity using JDBC. Each practical includes a brief description of the objective and a placeholder for code and output.

Uploaded by

nagarshalu37
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views19 pages

Java Programming Practical Exercises

The document outlines a series of practical Java programming exercises, each with specific objectives such as accepting student details, finding maximum and minimum values in an array, creating a simple calculator, and implementing exception handling. It also covers concepts like inheritance, user-defined packages, threading, and database connectivity using JDBC. Each practical includes a brief description of the objective and a placeholder for code and output.

Uploaded by

nagarshalu37
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Practical-1

Objective: Write a Java program to accept student details


(name, age, course) via command-line arguments and display
them.
Code:

Output :
Practical-2
Objective: Implement a Java program to accept an array of
integers, find the maximum and minimum elements, and
display them.
Code:
Output:
Practical-3
Objective: Develop a simple calculator using switch-
case that performs addition, subtraction,
multiplication, and division.
Code :
Output :
Practical-4
Objective: Write a Java program to check whether a given
string is a palindrome using StringBuffer.
Code:

Output:
Practical-5
Objective: Implement a program where a base class
Employee has attributes name, ID, and salary, and derived
classes calculate bonuses for different employee types.
Code:
Output:
Practical-6
Objective: Develop a Java program where one class
implements multiple interfaces to demonstrate multiple
inheritance.
Code:
Output:
Practical-7
Objective: Create a user-defined package of math
operations that contains classes for addition, subtraction,
multiplication, and division, and use them in a main program.
Code:
Output:
Practical-8
Objective: Implement a Java program to handle division by
zero exception using try-catch and finally blocks.
Code:

Output:
Practical-9
Objective: Create a Java program that spawns two threads:
one prints even numbers, the other prints odd numbers up to
100.
Code:
Output:

Practical-10
Objective: Implement a Java program where multiple
threads try to withdraw money from a shared bank account,
ensuring proper synchronization.
Code:
Output:
Practical-11
Objective: Create a Java program that connects to a MySQL
database, inserts student records, and retrieves them using
JDBC.
Code:
Output:

You might also like