bonjour a tous,

je n'arrive pas a faire le main dans mon programme, il me fait un null pointer exception alors que j'ai instancier mon objet.
je vous joint mon code

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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
public class Ethernet {
	 static int []adresse;
 
 
 
	public Ethernet (int []adresse)throws stop,stop1{
 
		if (adresse.length>6){
			throw new stop();
		}
		for (int i=0;i<adresse.length-1;i++){
			if ((adresse[i]>255)||(adresse[i]<0)){
				throw new stop1();
			}
		}
	}
	public String toString (){
		String prefixe = " adresse : ";
		String res = "";
		for (int i=0;i<adresse.length-1;i++){
			res=res + prefixe + Integer.toHexString(i);
			prefixe = ":";
				}
		return res;
	}
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + Arrays.hashCode(adresse);
		return result;
	}
 
	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (!(obj instanceof Ethernet))
			return false;
		Ethernet other = (Ethernet) obj;
		return Arrays.equals(adresse, other.adresse);
	}
	public static void main(String[] args) throws stop,stop1{
		Scanner lectureClavier = new Scanner (System.in);
 
	try {
 
Ethernet e1 = new  Ethernet(adresse);
		for (int i=0;i<adresse.length-1;i++){
			System.out.print(" Entrer le nombre" +(i+1)+":");
			adresse [i] = lectureClavier.nextInt();
		}
		System.out.println(" résultat " + e1);
	}catch (stop e1){
		System.out.print(" Nombres dépassés ");
	}
	}
}
class stop extends  RuntimeException {
 
	/**
         * 
         */
	private static final long serialVersionUID = 1L;}
class stop1 extends RuntimeException{
 
	/**
         * 
         */
	private static final long serialVersionUID = 1L;}