Given the following class Base {into Age =33 ;} How you can improve above class with respect to accessing the field Age?

A. Define the variable Age as private

B. Define the variable Age as protected

C. Define the variable Age as private and create a get method that return it and a set method that update it

D. Define the variable Age as protected and create a set method that return it and a get method that update it

See Correct Answer

C. Define the variable Age as private and create a get method that return it and a set method that update it

Submitted By : Ahsan Ali Soomro

%d bloggers like this: