Question: class Student { String gender: void setGender (String g) ( this.gender = s; } } a. How do you make the instance variable gender accessible

class Student { String gender: void setGender (String g) ( this.gender = s; } } a. How do you make the instance variable gender accessible only to Student class? Add the Java code below, Make sure the variable name follows Java convention for constants (5 points) class Student { String gender; void setGender (String g) ( this.gender = s; } } b. How do you access the gender variable/property after (a) above? Add the Java code below (10 points) class Student { String gender; void setGender (String g) ( this.gender = s; } // write the code below
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
