.


:




:

































 

 

 

 


.




, , Java . . .

static . , , . . , . Java final (, ),

Java , . , , . , - , . , . .

, , - , , , .

moveTo. , -. , . - Figure :

 

public void moveTo(int x, int y){

hide();

x=this.x;

y=this.y;

show();

};

 

, . .

, Figure . hide show, , , , !

hide show , , , , . , Figure, , Figure! , , hide show . dot1 Dot circle1 Circle, . , dot1.moveTo(x1,y1) circle1.moveTo(x2,y2).

dot1.moveTo(x1,y1) Figure moveTo. , Dot , , Figure. moveTo hide. , dot1, . Dot. , . , show. , dot1, . Dot. , .

circle1.moveTo(x2,y2) hide show , circle1, Circle. , .

, . - . , - - , , Ellipse, Circle, Ellipse ellipse=new Ellipse(), ellipse.moveTo() . , Ellipse hide show. , - Figure. , moveTo moveTo.

- . . . , (DMT Dynamic Methods Table) , (VMT Virtual Methods Table).

, - . , , () . , Java .

Object

Object Java. . Object :

public Boolean equals(Object obj) true , , , , obj . , false. Object ==. , . , . :

Double d1=1.0,d2=1.0;

System.out.println("d1==d2 ="+(d1==d2));

System.out.println("d1.equals(d2) ="+(d1.equals(d2)));

d1==d2 =false, d1.equals(d2) =true

 

public int hashCode() - . - , - . . Java - , - .

protected Object clone() throws CloneNotSupportedException () . Object , , Clonable. , , CloneNotSupportedException ( ). .

: (shallow), , (deep), , , . , . , . , , . , . .

public final Class getClass() . , , .

protected void finalize() throws Throwable . Object, - ( , , - , ..). .

public String toString() ( , ). Object ( ), @, - . . , , ( !). ,

Object obj=new Object();

System.out.println(" obj.toString() "+obj.toString());

Double d=new Double(1.0);

System.out.println(" d.toString() "+d.toString());

Character c='A';

System.out.println("c.toString() "+c.toString());

 

obj.toString() java.lang.Object@fa9cf

d.toString() 1.0

c.toString() A

notify(), notifyAll(), wait, (threads). , .





:


: 2017-02-28; !; : 713 |


:

:

.
==> ...

1980 - | 1732 -


© 2015-2024 lektsii.org - -

: 0.014 .