The document defines classes for a student and teacher with name and gender attributes for the student and name and subject for the teacher. Both classes implement a study method that prints a message with their name and activity, studying for the student and teaching for the teacher. The main method creates a teacher object, sets the name and subject, and calls the study method to print the teacher is teaching Java.
The document defines classes for a student and teacher with name and gender attributes for the student and name and subject for the teacher. Both classes implement a study method that prints a message with their name and activity, studying for the student and teaching for the teacher. The main method creates a teacher object, sets the name and subject, and calls the study method to print the teacher is teaching Java.
The document defines classes for a student and teacher with name and gender attributes for the student and name and subject for the teacher. Both classes implement a study method that prints a message with their name and activity, studying for the student and teaching for the teacher. The main method creates a teacher object, sets the name and subject, and calls the study method to print the teacher is teaching Java.