J'obtiens souvent ce genre d'erreur :
PhoneClient.java:131: non-static variable this
c context
this.inter.init();
^
C'est du a quoi,
j'ai bien initialiser inter
[/b]
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36 import java.net.*; import java.io.*; import java.util.*; public class PhoneClient { private Socket socket = null; private ObjectOutputStream os = null; private ObjectInputStream is = null; [b]private InterfaceClient inter = null;[/b] public PhoneClient(String serverIP) { // public static void main(String args[]) { PhoneClient theApp = new PhoneClient(args[0]); try { //test to send port and hostname // theApp.address(); [b] this.inter.init();[/b] theApp.getDate(); //theApp.ShutDown(); } catch (Exception ex) { System.out.println(ex.toString()); }
Partager