Note that there are some explanatory texts on larger screens.

plurals
  1. POfunction non static in class calling
    text
    copied!<p>hello i whave an function which it take the number after the (.) and after "Vl" in string so i want call this function on the code but they tell me this error</p> <pre><code>non-static method Ajuster(String) cannot be referenced from a static context </code></pre> <p>this the code</p> <pre><code>public class Test { public Integer Ajuster(String data) { Integer vlan=0; if (data.indexOf("Vl") &gt;= 0) { int pos = data.indexOf("Vl") + 2; String vl = data.substring(pos, data.length()); vlan=Integer.parseInt(vl.trim()); } else { int pos = data.lastIndexOf(".") + 1; String vl = data.substring(pos, data.length()); try { vlan=Integer.parseInt(vl.trim()); } catch (Exception e) { e.printStackTrace(); } } return vlan; } public static void main(String[] args) { Connection conn = null; try { conn = DriverManager.getConnection("jdbc:mysql://localhost/mohammedia", "root", "123456"); String sql = "SELECT * FROM router;"; Telnet_Interface telnet = new Telnet_Interface(); Telnet_Ressources telnet_R = new Telnet_Ressources(); Telnet_Interface telnet1 = new Telnet_Interface(); Telnet_Interface telnet2 = new Telnet_Interface(); PreparedStatement prest = conn.prepareStatement(sql); ResultSet res=prest.executeQuery(); while(res.next()){ telnet1.Config(res.getString(1), "noc", "nocwana", res.getString(1)); telnet2.Config(res.getString(2), "noc", "nocwana", res.getString(2)); } ArrayList myData=telnet.getMyData(); ArrayList myData1=telnet1.getMyData(); ArrayList myData2=telnet2.getMyData(); for(int i=0;i&lt;myData1.size();i++) { String data1=myData1.get(i).toString(); Integer vl1=Ajuster(data1); System.out.print(vl1); } } } </code></pre> <p>so the problem it's about the line: Integer vl1=Ajuster(data1); Thank you</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload