You are on page 1of 1

Inheritance: The SavingsAccount class inherits from the Account class, which means that it

automatically gains all the fields and methods of the Account class. This allows the SavingsAccount
class to reuse and extend the functionality of the Account class without having to redefine common
attributes and behaviors.

Polymorphism: The SavingsAccount class demonstrates polymorphism by overriding the


calcSavingWithdraw method from the superclass. This means that when an object of type
SavingsAccount is used, the overridden method will be called instead of the method from the
superclass. This allows for different behavior for withdrawing from a savings account compared to a
regular account, while still using a common interface (the calcSavingWithdraw method) for both
types of accounts.

IOException: method which is an exception in Java that is thrown when an input/output operation
fails or is interrupted. Input/output operations include reading from or writing to files, network
connections, or other sources of data.

This type of exception is a checked exception, which means that it must be either caught using a try-
catch block or declared in the method signature using the throws keyword. This helps ensure that
the calling code handles potential input/output errors appropriately.

Common causes of IOException include

1. File not found: When attempting to read from or write to a file that does not exist.

2. Permission issues: When the program does not have the necessary permissions to access a file or
directory.

3. Network issues: When there are problems with network connections, such as timeouts or
unavailable resources.

4. Disk full: When there is not enough space on the disk to complete the input/output operation.

InputMismatchException: is an exception that is thrown by Java’s Scanner class when it encounters


input that does not match the expected type. For example, if you use the nextInt() method to read
an integer from the user, but the user enters a non-integer value (such as a letter or a symbol), the
Scanner will throw an InputMismatchException.

You might also like