125k views
3 votes
Explain the following terms.

a) Explain Final keyword with example. b) Define Static and Instance variables

1 Answer

5 votes

Answer:

A.

the final keyword is used to denote constants. It can be used with variables, methods, and classes. Once any entity (variable, method or class) is declared final , it can be assigned only once.

B.

Static variables are declared in the same place as instance variables, but with the keyword 'static' before the data type. While instance variables hold values that are associated with an individual object, static variables' values are associated with the class as a whole.

User David Fells
by
3.9k points