Hello
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;
    }

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 =)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.