[Go to site: main page, start]

0% found this document useful (0 votes)
8 views2 pages

Java Programming Concepts and Examples

The document contains a list of short and long questions related to Java programming, covering topics such as object-oriented programming principles, inheritance, exception handling, threading, and Java I/O. It includes specific programming tasks and examples to illustrate concepts. The questions are categorized into units, with short questions worth 2 marks and long questions worth 10 marks.

Uploaded by

saisudheer400
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)
8 views2 pages

Java Programming Concepts and Examples

The document contains a list of short and long questions related to Java programming, covering topics such as object-oriented programming principles, inheritance, exception handling, threading, and Java I/O. It includes specific programming tasks and examples to illustrate concepts. The questions are categorized into units, with short questions worth 2 marks and long questions worth 10 marks.

Uploaded by

saisudheer400
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

Short / 2 mark questions

1. What is an abstract class? Give an example.


2. Explain the use of the for loop in Java with an example.
3. What is a package in Java? What is its purpose?
4. List the benefits of stream-oriented I/O in Java.
5. How do you start and stop a thread in Java?
6. What are the thread states in Java?
7. Differentiate between class and object in Java.
8. Contrast abstract class vs interface in Java.
9. What is the difference between checked and unchecked exceptions?
10. What is the difference between byte streams and character streams?
11. Explain the this keyword in Java with an example.
12. What is method overloading? What is method overriding?
13. What is the super keyword used for in Java?
14. Define inheritance. What are the benefits of inheritance?
15. What are types of polymorphism?
16. What is typecasting?
17. What is the difference between static and instance variables?
18. What are command-line arguments? Give an example.
19. Explain the use final keyword.
20. What is dynamic method dispatch?
21. What is dynamic method dispatch?
22. What are access modifiers?
23. What is the purpose of finally block?
24. What is the difference between throw and throws?
25. What is serialization in Java?
26. What is the difference between String, StringBuilder, and StringBuffer?
27. What is autoboxing and unboxing?
28. What is difference between compare and compareTo?
Long / 10-mark questions

UNIT-I
1. Explain the main principles of OOP with examples.
2. Write a Java program to illustrate constructor overloading.
3. Explain the memory allocation model of Java.
4. Explain the difference between pass-by-value and pass-by-reference in Java with
examples.

UNIT-II
1. Explain different types of inheritance in Java with examples.
2. Explain the basic principles of OOP (encapsulation, inheritance, polymorphism,
abstraction) and describe how Java supports them with examples.
3. Write a program to demonstrate single and multilevel inheritance.
4. Explain how interfaces achieve multiple inheritance in Java.
5. Explain packages in Java and the steps to create and use them.
6. Discuss access control in Java with suitable examples.

Programs
1. Transpose of a matrix
2. Addition/Multiplication of matrix

UNIT-III
1. Explain the exception hierarchy in Java with examples.
2. Write a program to handle multiple exceptions using try–catch blocks.
3. Explain the life cycle of a thread with a neat diagram.
4. Write a Java program to create multiple threads using Runnable interface.
5. Write a Java program to demonstrate inter-thread communication (wait(), notify()).

UNIT-IV
1. Explain Java I/O stream hierarchy with a neat diagram.
2. Explain serialization and deserialization in Java with an example.
3. Write a Java program to read data from a file line by line.

UNIT-V
1. Write a Java program to reverse a string.
2. Write a Java program to check if a string is palindrome.
3. Write a Java program that uses a generic method to find the largest element in an
array.
4. Explain string handling in Java with examples.
5. Explain different types of layout managers with suitable examples. Write a program
to create a frame window that responds to mouse clicks.

You might also like