method non static
public class LoGIne{
public String user (String a){
String rr = txt_user.getText();
String pass = txt_pass.getText();
//ConDb(user,pass);
return rr;
}
---------------------------------------------------
method static
public static Connection ConDb(){
//String USER ="mh";
String d ,l,h;
d =("ameer");
String PASS=d;
LoGIne a = new LoGIne();
String USER = a.user(h);
// String PASS = "ameer";
try{
//STEP 2: Register JDBC driver
Class.forName("oracle.jdbc.driver.OracleDriver");
Connection conn = DriverManager.getConnection(DB_URL,USER,PASS);
return conn;
}catch(Exception e){
JOptionPane.showMessageDialog(null, e);
return null;
}
--------------------
we will return value of function user to use it in function conDB to give value into this
USER = user(h);
Connection conn = DriverManager.getConnection(DB_URL,USER,PASS);