Advertisement
vencinachev

MainClassGabi

Jun 10th, 2020
835
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.40 KB | None | 0 0
  1. import java.io.*;
  2.  
  3. class Student implements Serializable {
  4.     String name;
  5.     String egn;
  6.     int note;
  7.  
  8.     Student(String name, int note, String egn) {
  9.         this.name = name;
  10.         this.note = note;
  11.         this.egn = egn;
  12.     }
  13.  
  14.     public String toString() {
  15.         return name + " " + note + " " + egn;
  16.     }
  17.    
  18.     public int compareTo(Student other) {
  19.         return this.name.toLowerCase().compareTo(other.name.toLowerCase());
  20.     }
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement