Home > Back-end >  What a great god can see the Student stu: what is the meaning of students and how to use this flag
What a great god can see the Student stu: what is the meaning of students and how to use this flag

Time:11-26

Public class StudentDAOImpl implements IStudentDAO
{
Public static List Students=new ArrayList (a);

Public void deleteStudent (String sno)
{
A Boolean flag=false;
If (students. The size () & gt; 0)
{
For (Student stu: students)
{
If (stu. GetSno (.) the equals (sno))
{
flag=true;
Students. Remove (stu);
System. Out.println (" the student id student deleted successfully!" );
}
}
if(! Flag)
{
System. Out.println (" database without the student record!" );
}
}
The else
{
System. Out.println (" no student record in the database!" );

}
}

CodePudding user response:

Student stu: students enhanced for loop students is a collection and stu is traversed each Student entity class

Flag is a Boolean value that is true or false! Flag of them! Is the invert, is if the flag is true to use! Is false, if the flag is false use! It is true

CodePudding user response:

The
reference 1/f, Jason Williams (????????????? ?). Response:
Student stu: students enhanced for loop students is a collection and stu is traversed each Student entity class

Flag is a Boolean value that is true or false! Flag of them! Is the invert, is if the flag is true to use! Is false, if the flag is false use! Is true

Explain clearly to detailed.

CodePudding user response:

For (Student stu: students) enhanced for loop students set Student set of generic stu customization parameters Student object
Objective: according to the student id delete student record
To determine whether a student number in the student record first,
All the student record query, if the student record is empty, rather than in the student record, then the students don't have to delete the
If the student record is not null, then the cycle each student, and according to the student id to judge whether there is, there are deleted,
Student id should be will not be repeated, student id if it exists, add a break out of circulation, is perfect
  • Related