- ( -), . , . .
int ary[][] = new int[][] { {1, 1, 1, 1}, {2, 2, 2}, {1, 2, 3, 4, 5}, }; int copyAry[][] = ary;, copyAry , . .
Java . java.util Arrays, (. ).
- 1. . , length, .
- 2. 0.
- 3. Java ( IndexOutOfBoundException).
- 4. , int, (.. ). . .. , , .
- 5. new .
- 6. , .. , "".
10)
, - . , , . , , , . , , -ϻ , , . , ( ). , ? , . Ƹ . .
Init GetX GetY . Location. , , . , , .
|
|
11)
(inheritance) (- ). , .
.
A, a1, a2,..., an f1(), f2(),..., fm(). B. B A ( ). , B :
- ;
- ;
- - A.
, .
:
class B extends A {... // B}" ", B.
A (superclass), - , . B - , , (subclass), -.
, A , A, B.
. , .
( )
class Base { int a, b, c;...} class Derived extends Base { long d, e;...}Base (a, b c), Derived - (a, b, c, d e).
( )
class Base { int f() {... } void g(int p) {... }} class Derived extends Base { long f1() {... } }Base (f() g(...)), Derived - (f(), g(...) f1()).
( )
class Base { int f() {... } void g(int p) {... }} class Derived extends B { int f() {... } }Base (f() g(...)) Derived (f() g(...)). Derived f() Base, f() Derived. overriding.
(overriding) , . , "long f()..." "private int f()..." .
Object
Java , .., "extends _", extends Object. .. Object Java.
Object , . , Java , Object.
Object. Object , ( ) . .
public String toString() .
protected Object clone() throws CloneNotSupportedException .
public boolean equals(Object obj) .
|
|
public final Class getClass() Class.
protected void finalize() throws Throwable .
, getClass , , toString, ( , ).
getClass Class, . toString , .
, , , , , , Object.
, , equals. - . Object ( ) , . Object " " - . .. , . , - .
. .