Advertisement
Guest User

1

a guest
Apr 7th, 2020
213
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.03 KB | None | 0 0
  1. package college;
  2.  
  3. public class StudentAccount {
  4.    
  5.     // instance fields
  6.    
  7.     private String name;
  8.     private int studentNumber;
  9.    
  10.     // constructor
  11.    
  12.         public StudentAccount (String a, int b ) {        // made a method and defined a as string and b as int
  13.            
  14.             name = a;                      // used because we can't call the variable -
  15.             studentNumber = b;             // - arguments from inside the method, we are giving it a value
  16.          
  17.      
  18.         }
  19.            
  20.    public String getName(){ return name; }                      // making a constructor for the name
  21.    public int getStudentNumber () { return studentNumber; }     // making a constructor for the student number
  22.                                                                 // making a constructor so that it can be called
  23. }                                                               // return statment is used to return the information
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement