0% found this document useful (0 votes)
2 views

java-lab-exercises

The document outlines a series of Java programming exercises focused on various tasks such as temperature conversion, string manipulation, sorting, account management, CRUD operations, file I/O, multi-threading, and testing with JUnit. Each exercise includes specific input data and expected output to guide implementation. The exercises cover fundamental programming concepts and applications in Java.

Uploaded by

Suresh
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

java-lab-exercises

The document outlines a series of Java programming exercises focused on various tasks such as temperature conversion, string manipulation, sorting, account management, CRUD operations, file I/O, multi-threading, and testing with JUnit. Each exercise includes specific input data and expected output to guide implementation. The exercises cover fundamental programming concepts and applications in Java.

Uploaded by

Suresh
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

EXERCISE 01: Write a Java program to convert temperature from Celsius to Fahrenheit

degrees.
Test Data
Input a degree in Celsius: 100.0
Expected Output:
100.0 degree Celsius is equal to 212 in Fahrenheit

java CelsiusToFahrenheit.java 100

EXERCISE 02: Write a Java program for temperature conversion with below options.

TempConverterApp.java

Welcome to Temperature Converter App!!!

1) Celsius to Fahrenheit
2) Fahrenheit to Celsius
3) Exit

Enter the Option:

(if option 1) Enter the value in Celsius:


(if option 2) Enter the value in Fahrenheit:

Print the the converted temperature

(If option 3) Thank you!!

EXERCISE 03: Write a Java program to reverse a string.

Input Data: Welcome to Java Training

Expected Output: gniniarT avaJ ot emocleW

EXERCISE 04: Write a Java program to sort the given set of numbers

Input Data: 30, 50, 20, 10, 50, 40

Expected Output: 10, 20, 30, 40, 50, 60

EXERCISE 05: Write a Java program to sort the given set of strings

Input Data: Java, Simple, ObjectOriented, Threaded, Dynamic, Secure, Language

Expected Output: Dynamic, Java, Language, ObjectOriented, Secure, Threaded

EXERCISE 06: Write an Account Manager program with below options with an ability to
read/write the details from/to the console

1. Create Account
2. Update Account
3. View Account
4. Deposit Amount
5. Withdraw Amount
6. Close Account
7. Exit

EXERCISE 07: Write a program to perform CRUD operations with Order using ArrayList

Order:
int id
String description
String category
int quantity
double price

EXERCISE 08: Write a program to perform CRUD operations with Order using HashSet

EXERCISE 09: Write a program to perform CRUD operations with Order using HashMap
and also show below details

a. Show Order Category wise Count

b. Show Order Category wise Total Amount

EXERCISE 10: Write a generic program to sort given set of data [numbers or strings
or objects] using Java Generics

EXERCISE 11: Write a program to read/write Order details from file system using
Java File IO

EXERCISE 12: Write a multi-threading program to read/write Order details from using
Java File IO asynchronously

EXERCISE 13: Write a program to perform CRUD operations with Order using JDBC

EXERCISE 14: Write a program to perform validations on Order using Lambda


Expressions and also show below details using Stream API

a. Show Order Category wise Count


b. Show list of Order IDs belongs to particular Category
b. Show Order Category wise Total Amount

EXERCISE 15: Write a Junit program to test the OrderService performing CRUD
operations

You might also like