both of these methods compile.
Howerver, Are these two methods the same? or does one offer something more?
method 1

public AdminDAO getAdminDAO() {
        return new ConnectAdminDAO();

method 2 note:getXMLResource() returns: <entry key="adminDAO">model.dao.ConnectAdminDAO</entry>

public synchronized static AdminDAO getAdminUserDAO() throws ClassNotFoundException, InstantiationException, IllegalAccessException, FileNotFoundException, IOException {
            Class daoClass = Class.forName(ModelUtils.getXMLResource("adminDAO"));
            adminDAO =  (ConnectAdminDAO) daoClass.newInstance();
       System.out.println("CREATED NEW INSTANCE OF ConnectAdminDAO");
        return adminDAO;
6 Years
Discussion Span
Last Post by Abdel_eid

yeah there is a great difference first of all ,the first method is a normal method while the second method is a synchronized method which support multi threading processes , we can have a long big discussion about multi threading but briefly synchronized method doesn't permit the process to take the thread from until it finish what it want to do , the thread can then be taken from after the curly brackets are closed , on the opposite side is the first process... hope that help you =)

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.