i coded like this
import static adminDetails.Provider.*; import java.sql.*; public class ConnectionProvider { private static Connection con; static{ try{ Class.forName(DRIVER); con=DriverManager.getConnection(CONNECTION_URL,USERNAME,PASSWORD); }catch(Exception e){} } public static Connection getCon(){ return con; } } and use this code in another java file with a static method call like this
public class AdministrationDetails { Connection con=ConnectionProvider.getCon(); //... } In java API also they are doing static imports like this. My question is why do we need static method call instead normal object, what is the difference.