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

Java_Differentiates_Questions_Answers

The document outlines key differences between various Java programming concepts, including Class vs Interface, Abstract Class vs Interface, Method Overloading vs Method Overriding, and data structures like Array vs Vector and Array vs ArrayList. It highlights characteristics such as mutability, inheritance, and method behavior. The comparisons provide essential insights into the functionality and usage of these Java elements.

Uploaded by

dohareareena
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views2 pages

Java_Differentiates_Questions_Answers

The document outlines key differences between various Java programming concepts, including Class vs Interface, Abstract Class vs Interface, Method Overloading vs Method Overriding, and data structures like Array vs Vector and Array vs ArrayList. It highlights characteristics such as mutability, inheritance, and method behavior. The comparisons provide essential insights into the functionality and usage of these Java elements.

Uploaded by

dohareareena
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Java Programming - Differentiate Questions (with 6-Point Answers)

Class vs Interface

1. Class can contain both concrete and abstract methods.

2. Interface contains only abstract methods (Java 8+ allows default/static).

3. Classes support single inheritance.

4. Interfaces support multiple inheritance.

5. Class variables can be private, protected, or public.

6. Interface variables are always public static final.

Abstract Class vs Interface

1. Abstract class can have constructors.

2. Interface cannot have constructors.

3. Abstract class can contain concrete methods.

4. Interface cannot contain concrete methods (except default/static in Java 8+).

5. Abstract class supports single inheritance.

6. Interface supports multiple inheritance.

Method Overloading vs Method Overriding

1. Overloading: Same method name, different parameters.

2. Overriding: Subclass changes superclass method behavior.

3. Overloading occurs in the same class.

4. Overriding occurs across superclass and subclass.

5. Overloading supports compile-time polymorphism.

6. Overriding supports runtime polymorphism.

Array vs Vector

1. Array has fixed size.

2. Vector can grow dynamically.

3. Array is not synchronized.

4. Vector is synchronized.

5. Array holds both primitives and objects.

6. Vector holds only objects.


String vs StringBuffer

1. String is immutable.

2. StringBuffer is mutable.

3. String is faster for small operations.

4. StringBuffer is better for frequent changes.

5. String creates new objects when changed.

6. StringBuffer modifies the same object.

Applet vs Application

1. Applet runs in browser.

2. Application runs on desktop.

3. Applet doesn't use main() method.

4. Application uses main() method.

5. Applet has security restrictions.

6. Application has full system access.

Array vs ArrayList

1. Array has fixed size.

2. ArrayList has dynamic size.

3. Array can hold primitives and objects.

4. ArrayList holds only objects.

5. Array is faster and simpler.

6. ArrayList has built-in methods (add, remove).

String vs StringBuilder

1. String is immutable.

2. StringBuilder is mutable.

3. String is thread-safe by default.

4. StringBuilder is not thread-safe.

5. String is less efficient for frequent changes.

6. StringBuilder is more efficient in single-threaded.

You might also like