andersonalmada

Untitled

May 16th, 2018
256
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.68 KB | None | 0 0
  1. public class DaoPatternDemo {
  2.    public static void main(String[] args) {
  3.       StudentDao studentDao = new StudentDaoImpl();
  4.  
  5.       //print all students
  6.       for (Student student : studentDao.getAllStudents()) {
  7.          System.out.println("Student: [RollNo : " + student.getRollNo() + ", Name : " + student.getName() + " ]");
  8.       }
  9.  
  10.  
  11.       //update student
  12.       Student student =studentDao.getAllStudents().get(0);
  13.       student.setName("Michael");
  14.       studentDao.updateStudent(student);
  15.  
  16.       //get the student
  17.       studentDao.getStudent(0);
  18.       System.out.println("Student: [RollNo : " + student.getRollNo() + ", Name : " + student.getName() + " ]");    
  19.    }
  20. }
Add Comment
Please, Sign In to add comment