1
2
3
4
5
|
public
class
Test {
public
static
void
main(String[] args) {
java.util.ArrayList list =
new
java.util.ArrayList();
}
}
|
1
2
3
4
5
6
|
import
java.util.ArrayList;
public
class
Test {
public
static
void
main(String[] args) {
ArrayList list =
new
ArrayList();
}
}
|
1
|
import
java.util.*;
|
1
2
3
|
package
access.mypackage;
public
class
MyClass {
}
|
1
2
3
4
5
6
|
import
access.mypackage.*;
public
class
Test {
public
static
void
main(String[] args) {
MyClass m =
new
MyClass();
}
}
|
1
2
3
4
5
6
7
8
9
10
11
|
class
Test {
public
void
SayHello() {
System.out.println(
"Hello World!"
);
}
}
public
class
Main {
public
static
void
main(String[] args) {
Test t =
new
Test();
t.SayHello();
}
}
|
1
2
3
4
5
6
7
8
9
10
11
|
class
Test {
private
Test() {}
static
Test makeTest() {
return
new
Test();
}
}
public
class
Main {
public
static
void
main(String[] args) {
Test t = Test.makeTest();
}
}
|
1
2
|
class
SubTest
extends
Test {
}
|
1
2
3
4
5
6
7
8
9
10
11
|
class
Test {
protected
void
sayHello() {
System.out.println(
"Hello World!"
);
}
}
public
class
Main {
public
static
void
main(String[] args) {
Test t =
new
Test();
t.sayHello();
}
}
|
1
2
|
public
class
Test {
}
|