Download as pdf or txt
Download as pdf or txt
You are on page 1of 1

Classroom Assignment <1>: Demonstrating Browser Inheritance in Java

Learning Objective:

To understand and implement the concept of inheritance in Java by creating a generic Browser class and a subclass
which inherits the methods of the Super Class.

Expected Completion Time:

Best Case: 15 minutes


Average Case: 20 minutes

Assignment Details:

- Create a superclass with variables and methods


- Then create a subclass that inherits from the superclass

Requirements:

- Create a superclass Browser.


- Add at least two variables to the Broswer class: browserName and browserVersion
- Implement 3 methods openURL(), closeBrowser(), navigateBack() in the Browser class.
- Create subclasses such as Chrome, Edge and Safari
- Define openIncognito() and clearCache() methods in Chrome class
- Define takeSnap() and clearCookies() methods in Edge class
- Define readerMode() and fullScreenMode() methods in Safari class
- Demonstrate the concept by creating objects for both classes and calling their methods.

Hints to Solve:

- Use appropriate keyword to extend one class with another class


- Initialize objects using appropriate keyword and test the functionality by calling the methods.

Reference Links:

Inheritance in Java - Oracle Docs

Expected Outcome:

Upon completion, you should be able to:


- Grasp the fundamentals of inheritance in Java by creating a subclass that inherits attributes and methods
from a superclass.

You might also like