Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package person;
- import java.util.ArrayList;
- import java.util.Collections;
- import p2.Helper;
- import p2.Student;
- public class Tester2 {
- public static void main(String[] args) {
- // TODO Auto-generated method stub
- Person p = new Person(1,"2");
- Student S = new Student(1, "DF",123);
- Double D = new Double(0.12);
- double d1 = 0.1;
- String s = "1234";
- String s2 = "12343";
- ArrayList<Helper> helpers = new ArrayList<>();
- Car c = new Car(100);
- helpers.add(new Student(1, "asd", 1234));
- helpers.add(new Student(2, "a1sd", 1234));
- helpers.add(new Student(3, "a2sd", 1234));
- helpers.add(new Student(1, "a3sd", 1234));
- helpers.add(new Student(5, "as2d", 1234));
- helpers.add(new Student(4, "as1d", 1234));
- helpers.add(new Student(10, "as5d", 1234));
- System.out.println(helpers);
- Collections.sort(helpers);
- System.out.println(helpers);
- try {
- if(helpers.get(0) instanceof Student)
- ((Student)helpers.get(0)).show(1);
- else
- System.out.println("helpers.get(1) instanceof car");
- } catch (Exception e) {
- System.out.println(e.getMessage());
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement