0% found this document useful (0 votes)
0 views3 pages

Java Question

The document outlines various Java programming concepts and tasks, including Object-Oriented Programming features, type casting, access specifiers, method overloading, and exception handling. It also covers advanced topics like thread synchronization, user-defined exceptions, and the use of collections such as ArrayList and HashMap. Additionally, it discusses the differences between abstract classes and interfaces, and provides programming exercises to demonstrate these concepts.

Uploaded by

missioncancer
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)
0 views3 pages

Java Question

The document outlines various Java programming concepts and tasks, including Object-Oriented Programming features, type casting, access specifiers, method overloading, and exception handling. It also covers advanced topics like thread synchronization, user-defined exceptions, and the use of collections such as ArrayList and HashMap. Additionally, it discusses the differences between abstract classes and interfaces, and provides programming exercises to demonstrate these concepts.

Uploaded by

missioncancer
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
You are on page 1/ 3

1.

Explain the key features of Object-Oriented Programming (OOP) and how they are implemented in
Java. Provide examples for at least two features

2.Describe the concept of type casting in Java. Differentiate between implicit and explicit type casting
with examples

3.Write a Java program to demonstrate the use of access specifiers by creating a class with fields and
methods having different access levels. Explain the behaviour of each access specifier.

4.Develop a Java program to showcase method overloading by creating methods with the same
name but different parameter lists. Include at least three overloaded methods.

5.Explain the difference between `abstract` classes and `interfaces` in Java. Write a Java program to
implement an `Interface` and demonstrate how a class can implement multiple interfaces.

6.Create a Java program to demonstrate the use of `ArrayList` and `HashMap` from the Collections
Framework. Perform basic operations such as adding, removing, and iterating over elements.

7.Design a Java program to demonstrate linked structures by implementing a simple singly linked list
with operations like add, delete, and display.

8. Write a Java program to implement exception handling strategies by demonstrating the use of `try-
catch-finally` and `throws` keywords with a scenario involving division by ZERO

9.What is method overriding in Java? What is basic Difference between Overriding and Overloading?

10.Describe the steps involved in creating and using a user-defined exception in Java. Write a Java
program to handle an invalid bank transaction using a custom exception class.

11.Write a java program to find the number of and sum of all integers greater than 50 and less than
100 and are prime numbers

12.Write a Java program to find the second largest element in a 2D array.

13.Write a Java recursive method to check if a given array is sorted in ascending order

14.Write a Java program that creates a bank account with concurrent deposits and withdrawals using
threads.

15.Write a JAVA Program to demonstrate Constructor overloading and Method overloading. Also
access parent class constructor in child class

16.Create a class Student (name, roll_no, marks) with one method show() and initialize instance
variables using all the ways: reference, method and constructor

17.Develop a Java program to demonstrate thread synchronization using the `synchronized` keyword.
Create a scenario where multiple threads access a shared resource, and synchronize the access to
prevent data inconsistency

18.

Write a Java program to create an interface Shape with the getArea() method. Create three classes
Rectangle, Circle, and Triangle that implement the Shape interface. Implement the getArea() method
for each of the three classes.
19.

What will be the output of the following code Inner Class

class X{

static int x = 3131; static class Y

static int y = x++; static class Z

static int z = y++;

public class MainClass

public static void main(String[] args)

System.out.println(X.x); System.out.println(X.Y.y); System.out.println(X.Y.Z.z);

20.Write a Java program in which inherit one abstract class and implement methods of 3 interfaces.
One interface is containing default method and static method

21.

Write a Java program to create a method that takes an integer as a parameter and throws an
exception if the number is odd.

22.

Write a Java program to create an abstract class Employee with abstract methods calculateSalary()
and displayInfo(). Create subclasses Manager and Programmer that extend the Employee class and
implement the respective methods to calculate salary and display information for each role.

23.

Create a menu based calculator to perform various operations

24.

Develop a Java program to simulate a queue using the `LinkedList` class from the Collections
Framework. Include operations like enqueue, dequeue, and display
25.Differentiate between JDK, JVM, and JRE. Illustrate their roles in Java program execution.

You might also like