AK31

SHSStudent

Oct 5th, 2019
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.62 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class SHSStudent extends Student {
  4.     // inherits attributes from Student
  5.  
  6.     private String form;
  7.    
  8.      SHSStudent() {
  9.         // sets all fields in the parent class Student
  10.         super();
  11.     }
  12.  
  13.     public String getForm()
  14.     {
  15.         return form;
  16.     }
  17.  
  18.     public void setForm(String form)
  19.     {
  20.         this.form = form;
  21.     }
  22.  
  23.     public static void main (String[] args){
  24.  
  25.     System.out.println("Enter your form: ");
  26.     Scanner input = new Scanner(System.in);
  27.     String form = input.nextLine();
  28.     System.out.println("Form: " + form);
  29.  
  30.     }
  31.  
  32.    
  33. }
Add Comment
Please, Sign In to add comment