SI. No.
Question
1 Write a Java program to print "Hello, World!" on the screen.
2 Write a Java program to take input of two numbers and print their sum.
3 Write a Java program to check whether a number is even or odd.
4 Write a Java program to find the largest of three numbers.
5 Write a Java program to check whether a number is prime or not.
Assignment 1
6 Write a Java program to print the multiplication table of a number.
7 Write a Java program to calculate the factorial of a number using a loop.
8 Write a Java program to reverse a given number.
9 Write a Java program to check whether a string is a palindrome.
10 Write a Java program to print Fibonacci series up to n terms.
Sl. No. Java Program
1 Write a Java program to define a BankAccount class with deposit and withdrawal methods and create an object to simulate transactions.
2 Write a Java program to define a Student class and print student details using object.
3 Write a Java program to create a Book class and store details like title, author, and price, then print using an object.
4 Write a Java program to create a Car class with methods to start and stop the engine. Instantiate objects for different cars.
5 Write a Java program to define an Employee class to store employee ID, name, and salary, and display details.
6 Write a Java program to implement a Rectangle class and calculate area and perimeter using an object.
7 Write a Java program to define a Circle class and calculate area and circumference using methods.
8 Write a Java program to create a Movie class with movie name, genre, and rating and print the details of multiple movies.
9 Write a Java program to define a MobilePhone class to store brand, model, and price. Create objects and display them.
10 Write a Java program to simulate a Ticket booking system for a train using class and objects.
Assignment 2
11 Write a Java program to create a Library class with methods to add and issue books using objects.
12 Write a Java program to create a Calculator class with methods to add, subtract, multiply, and divide.
13 Write a Java program to define a TemperatureConverter class to convert Celsius to Fahrenheit and vice versa.
14 Write a Java program to simulate a ShoppingCart where items can be added with price and quantity using objects.
15 Write a Java program to implement a Clock class that shows the current time and allows setting alarms.
16 Write a Java program to define a Flight class with fields like flight number, source, destination, and create objects.
17 Write a Java program to simulate a WaterBottle class with fields for capacity, current level and methods to refill or drink water.
18 Write a Java program to create a Game class with player name, score, and level, and display details using objects.
19 Write a Java program to create a Bill class for an electricity bill with units consumed and calculate the bill amount.
20 Write a Java program to define a Loan class with principal, rate, and time and calculate interest using object methods.
S.No. Assignment
1 Write a Java program to create a BankAccount class with fields accountNumber, accountHolderName, and balance. Implement deposit() and withdraw() methods. Crea
2 Write a Java program to define a Student class with fields name, rollNumber, and marks. Use an object to assign values and display student details using displayDetail
3 Write a Java program to define a Car class with fields brand and engineStatus. Add methods startEngine() and stopEngine() to control the engine. Create multiple Car
4 Write a Java program to define an Employee class with fields id, name, and salary. Use a parameterized constructor to initialize data. Print employee details using a me
5 Write a Java program to create a Book class with fields title, author, and price. Use both default and parameterized constructors to initialize objects and display book in
6 Write a Java program to define a Circle class with a constructor that accepts radius. Implement methods to calculate area and circumference. Create objects using con
7 Write a Java program to create a Calculator class with overloaded add() methods for: (a) two integers, (b) two doubles, (c) three integers. Demonstrate all three in main
Assignment 3
8 Write a Java program to create a Rectangle class with overloaded calculateArea() methods for: (a) square and (b) rectangle. Show both types of area calculation using
9 Write a Java program to define a TemperatureConverter class with overloaded convert() methods: one for Celsius to Fahrenheit, another for Fahrenheit to Celsius.
10 Write a Java program with a base class Person having fields name, age, and a subclass Student with fields rollNumber and course. Use inheritance to display full detai
11 Write a Java program to create a base class Shape with method display(). Extend it in subclasses Circle, Rectangle, and Triangle which implement their own calculateA
12 Write a Java program to define a base class Vehicle with method move(). Derive subclasses Car, Bike, and Bus that override move() to show different behaviors.
13 Write a Java program to define a base class Animal with method makeSound(). Create subclasses Dog, Cat, and Cow that override the method. Use polymorphism wit
14 Write a Java program to create a base class Loan with method calculateInterest(). Derive HomeLoan, CarLoan, and PersonalLoan classes and override the method wi
15 Write a Java program to define a base class Payment with method pay(). Create subclasses CreditCard, DebitCard, and UPI that override the method to show the paym
Si. No. Java Programming Questions
Inheritance (Real-world Examples)
1 Write a Java program on single inheritance for a Vehicle → Car.
2 Write a Java program on multilevel inheritance for a Library → Book → EBook.
3 Write a Java program on hierarchical inheritance for Employee → Manager/Developer.
4 Write a Java program on multiple inheritance using interfaces for Printer & Scanner → MultiFunctionPrinter.
5 Write a Java program on hybrid inheritance for Person (class) + SportsPlayer (interface) → StudentAthlete.
Assignment 4
6 Write a Java program to demonstrate the use of the super keyword in a BankAccount → SavingsAccount.
7 Write a Java program on constructor inheritance in School → Teacher.
8 Write a Java program on method overriding in Animal → Dog/Cat.
9 Write a Java program on interface inheritance (interface extending another interface) for Shape → Drawable.
10 Write a Java program on a real-life inheritance example University → Student/Faculty. Assignment 4
Abstract, Final, Static, Dynamic Dispatch
11 Write a Java program to demonstrate an abstract class for Shape → Circle/Rectangle.
12 Write a Java program to demonstrate abstract methods in a Bank → Savings/Current.
13 Write a Java program to demonstrate final variables in a MathConstants class.
14 Write a Java program to demonstrate final methods in a Vehicle class.
15 Write a Java program to demonstrate a final class for Utility functions.
16 Write a Java program to demonstrate the static variable for counting number of Employees.
17 Write a Java program to demonstrate the static method in a Calculator class.
18 Write a Java program to demonstrate the use of a static block in Database Connection setup.
19 Write a Java program to demonstrate dynamic method dispatch for Payment → CreditCard/UPI.
20 Write a Java program to combine abstract + dynamic dispatch for Appliance → Fan/Light.