0% found this document useful (0 votes)
7 views1 page

OOP Java Assignment

The document outlines an assignment on Object Oriented Programming with Java, covering key concepts such as inheritance, polymorphism, and threading. It includes examples of abstract classes, thread lifecycle, and race conditions, along with definitions and comparisons of important terms. Additionally, it addresses the limitations of multiple inheritance in Java and emphasizes the importance of synchronization to prevent race conditions.

Uploaded by

arpitjadaunsingh
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)
7 views1 page

OOP Java Assignment

The document outlines an assignment on Object Oriented Programming with Java, covering key concepts such as inheritance, polymorphism, and threading. It includes examples of abstract classes, thread lifecycle, and race conditions, along with definitions and comparisons of important terms. Additionally, it addresses the limitations of multiple inheritance in Java and emphasizes the importance of synchronization to prevent race conditions.

Uploaded by

arpitjadaunsingh
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

OBJECT ORIENTED PROGRAMMING WITH JAVA - ASSIGNMENT

SECTION A

1(a) Output: 30

1(b) Java does not support multiple inheritance via classes but supports it using interfaces.

1(c) Overloading vs Overriding: Overloading is compile-time, overriding is runtime polymorphism.

1(d) Thread vs Runnable: Thread is class-based, Runnable is interface-based.

1(e) Static methods can be called without object.

1(f) Functional interface has only one abstract method.

SECTION B

2(a) Bank example implemented using abstract class and subclasses.

abstract class Bank {


abstract int getBalance();
}

2(b) Thread lifecycle: New → Runnable → Running → Waiting → Terminated

2(c) Race condition occurs due to lack of synchronization.

2(d) Multiple inheritance not allowed using classes.

SECTION C

3(a) Shape inheritance example implemented.

3(b) Output: Concrete method of parent class

[Link]() delays execution.

SECTION D

4(a) Concepts: Encapsulation, Polymorphism, Abstraction

4(b) Problem: Race condition. Solution: Synchronization

You might also like