class point{
float x;
float y;
public point(float x, float y) {
this.x = x;
this.y = y;
}
void affiche(){
System.out.println("point("+x+","+y+")");
}
void deplacer(float dx,float dy){
x=x+dx;
y=y+dy;
}
double distance(){
return Math.sqrt(Math.pow(x,2)+Math.pow(y,2));
}
public static void main(String args[]){
point p=new point(1,3);
p.affiche();
}}
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter