[Java daily question] 20161228, java20161228
Package Dec2016; import java. util. arrayList; import java. util. list; public class Ques1228 {public static void main (String [] arg) {Student stu01 = new Student ("001"); Student stu02 = new Student ("001 "); // In stu02, 001 is followed by a space List <Student> students = new ArrayList <Student> (); students. add (stu01); students. add (stu02); System. out. println ("students include 001 student ID:" + students. contains (stu01); System. out. println ("students include 002 student ID:" + students. contains (stu02) ;}} class Student {private String stuId; public Student (String stuId) {super (); this. stuId = stuId;} public String getStuId () {return stuId;} public void setStuId (String stuId) {this. stuId = stuId;} @ Override public boolean equals (Object obj) {if (obj instanceof Student) {Student stu = (Student) obj; return stuId. equalsIgnoreCase (stu. getStuId (). trim ();} return false ;}}
Today's question:
What is the output result of the main program? (Click "[Java daily question] 20161228" below to view issue resolution 20161227)
Questions originally published on the public account and short book: [Java daily question] 20161228, [Java daily question] 20161228
Note: The weknow team has recently activated and certified the Q & A service. You are welcome to listen. If you have any questions, please come to the Q & A service. Please refer to you !!