Java Questions

 Unit-1

1.

Explain the History and Evolution of Java.

2.

Describe command-line arguments. Write a Program to add two numbers using command-line arguments

3.

Define is a data type? Give the declaration of variables in Java. Write the rules?

4.

Define a class, method, and object. Write the syntax to define these in Java.

5.

What is a constructor? Classify the types of constructors in Java.

6.

Distinguish between method overriding and method overloading.

7.

Write a Java program to implement the inheritance concept.


Unit-2

1.

What is an abstract class? Explain all the cases to implement the abstract class.

2.

What is an interface? List the rules to create an interface in Java with an example.

3.

What is a package? Explain how to create user-defined packages in Java with an example. Write a Java program to find the factorial value of the given number using the user-defined package concept.

4.

What is a Java Exception and its types? Explain try-catch statements with examples.

5.

Write a Java program to create its own exception for Negative Value Exception if the user enters a negative value.

6.

What is multithreading? What are the ways to create multiple threads in Java? Explain the thread life cycle.

7.

Write a Java program to create two threads and execute simultaneously.

Unit-3

1.

How do Java's functional interfaces enhance code readability and flexibility, and what are their key characteristics?

2.

Explain the concept of lambda expressions in Java and provide examples of their practical usage in stream processing and event handling.

3.

What are method references in Java, and how do they simplify code that involves invoking methods?

4.

Discuss the significance of the Stream API in Java, including its role in functional programming paradigms and its common operations.

5.

How do Default Methods and Static Methods in Interfaces contribute to backward compatibility and code organization in Java?


Unit-4

1.

Explain the hierarchy of the Collection Framework in Java. Provide examples of each category.

2.

What is the difference between the Collection Interface and the Collections class in Java? Illustrate with code examples.

3.

Discuss the difference between the List Interface and the Set Interface in Java.

4.

Explain the differences between ArrayList, LinkedList, and Vector in Java. When would you choose one over the other?

5.

What are the key differences between HashMap, LinkedHashMap, TreeMap, and Hashtable in Java?

6.

Discuss the Comparable and Comparator interfaces in Java. When would you implement each interface, and what are their respective use cases?


Comments