Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class SHSStudent extends Student {
- // inherits attributes from Student
- private String form;
- SHSStudent() {
- // sets all fields in the parent class Student
- super();
- }
- public String getForm()
- {
- return form;
- }
- public void setForm(String form)
- {
- this.form = form;
- }
- public static void main (String[] args){
- System.out.println("Enter your form: ");
- Scanner input = new Scanner(System.in);
- String form = input.nextLine();
- System.out.println("Form: " + form);
- }
- }
Add Comment
Please, Sign In to add comment