Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class DaoPatternDemo {
- public static void main(String[] args) {
- StudentDao studentDao = new StudentDaoImpl();
- //print all students
- for (Student student : studentDao.getAllStudents()) {
- System.out.println("Student: [RollNo : " + student.getRollNo() + ", Name : " + student.getName() + " ]");
- }
- //update student
- Student student =studentDao.getAllStudents().get(0);
- student.setName("Michael");
- studentDao.updateStudent(student);
- //get the student
- studentDao.getStudent(0);
- System.out.println("Student: [RollNo : " + student.getRollNo() + ", Name : " + student.getName() + " ]");
- }
- }
Add Comment
Please, Sign In to add comment