94.9k views
1 vote
Add a String instance variable, messageUponExiting, to the Window class. This variable will be used to display a message when the user closes the window (for example, "Are you sure you want to quit?"). Furthermore, this variable should be accessible to all subclasses of the Window class, as each sort of window may require a different message upon exiting. Please provide the declaration of the instance variable only—nothing else.

User Ecc
by
6.9k points

1 Answer

4 votes

Answer:

Following are the Declaration of instance variable which is mention above .

protected String messageUponExiting; // variable declaration

Step-by-step explanation:

Here we declared a variable "messageUponExiting " as string type.The String datatype parameter will hold the string value .We can use Protected access modifier because as mention in the question the variable must be accessible in all of the subclass of windows.

Syntax of declaring any instance variable .

Access-modifier datatype variable-name;

User Rajomato
by
6.7k points