bonjour,
j'ai deux programmes
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
package b;
public class point {
	private int a,b;
	point(int x,int y)
		{
		this.a=x;
		this.b=y;
		}
	public void somme(point p1, point p2)
		{
			this.a=p1.a+p2.a;
			this.b=p1.b+p2.b;
		}
	public int abcisse()
		{
			return this.a;
		}
	public int ordonne()
		{
			return this.b;
		}
	public int surface()
		{
			return (this.a*this.b);
		}
	public void somme()
	{
	}
}

et
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
 /**
 * @(#)classepoint.java
 *
 * classepoint application
 *
 * @author 
 * @version 1.00 2017/9/26
 */
import b.*;
public class classepoint {
 
    public static void main(String[] args) {
 
    	point d=new point (3,4);
    	point e=new point (5,6);
    	point z=new point (1,2);
    	int surf;
    	z.somme(d,e);
    	surf=z.surface();
    	System.out.println(z.abcisse());
    	System.out.println(z.ordonne());
    	System.out.println("la surface est : "  + surf);	
    	System.out.println("Hello World!");
    }
}
j'ai placé les.java dans users
mais je n'arrive pas a les compiler
j'ai créé un dossier "b" correspondant a mon package b , je compile
mais celui qui import "b" je ne sais ou le mettre et de toute facon il ne compile pas


C:\Users\jm18c>cd b

C:\Users\jm18c\b>javac point.java

C:\Users\jm18c\b>cd..

C:\Users\jm18c>javac classepoint.java
classepoint.java:14: error: point(int,int) is not public in point; cannot be accessed from outside package
point d=new point (3,4);
^
classepoint.java:15: error: point(int,int) is not public in point; cannot be accessed from outside package
point e=new point (5,6);
^
classepoint.java:16: error: point(int,int) is not public in point; cannot be accessed from outside package
point z=new point (1,2);
^
3 errors

C:\Users\jm18c>cd b

C:\Users\jm18c\b>javac classepoint.java
classepoint.java:9: error: package b does not exist
import b.*;
^

merci par avance