Java Practicals List For Viva
Java Practicals List For Viva
Write a Java program that allows users to determine whether a given year is a leap year.
3 The program should provide clear feedback and allow users to check multiple years in
one short.
Write a Java program that prints all real solutions to the quadratic equation ax^2+bx+c =
4 0. Read in a, b, c and use the quadratic formula. If the discriminant b^2-4ac is negative,
display a message stating that there are no real solutions.
The Fibonacci sequence is defined by the following rule. The first 2 values in the
sequence are 1. Every subsequent value is the sum of the 2 values preceding it. Write a
5
Java program that uses both recursive and non-recursive functions to print the nth value
of the Fibonacci sequence.
Write a Java program that prompts the user for an integer and then prints out all the prime
6
numbers up to that integer using a do-while loop.
Write a Java program to find the length of the longest increasing subsequence in an
7
unsorted array.
Write a Java program to find the contiguous subarray within an array (containing at least
8
one number) that has the largest product.
Write a Java program for method overloading and constructor overloading for a simple
9 banking application. The program handles two main operations: crediting and debiting
amounts from a bank account.
Write a Java program to demonstrate method overriding and the super keyword for IT
company management system. (Design a base class Employee with a method getRole().
12
Create a subclass Manager that overrides getRole() to specify the role of a manager and
uses super to call the base class's method.)
Write a Java program to create inner classes for College Management system.(Design
14
classes for students and courses.)
Write a Java program that displays the number of characters, lines, and words in a text. (
Design and implement a Java program that analyzes a given text. The program should
15
also be able to perform text processing operations such as converting the text to
uppercase or lowercase, removing Blank Space from both side.)
Write a Java program that checks if a given string is a palindrome and allows the user to
16
check multiple strings in one run.
Write a Java program that reads a line of integers and then displays each integer and the
17
sum of all integers. (Use String Tokenizer class)?
Write a Java program for creating a single try block with multiple catch blocks which
18 should handled Arithmetic, NullPointer, NumberFormat and IndexOutOfBound
Exception.
Write a program for multiple try blocks and multiple catch blocks including finally Block
19
to handled all Runtime Exception.
20 Write a Java program for the producer-consumer problem using Threads.
Write a Java program that design how to create a dynamic array using the ArrayList class
21
to store string elements and then print the contents of the array.
Write a Java program that implements add, search, and remove operations on an
22
ArrayList to manage a list of books.