COMP2396
Loading...
Searching...
No Matches
abstracts.java
Go to the documentation of this file.
1
package
chapter7;
2
3
@SuppressWarnings(
"unused"
)
4
final
class
dog
extends
animal {
5
int
y;
6
@Override
7
void
mustbeoverriden() {
8
System.out.println(
"dog"
);
9
}
10
}
11
12
@SuppressWarnings(
"unused"
)
13
interface
friendly
{
14
void
pet
();
15
}
16
17
class
bruh {
18
public
final
int
x;
19
bruh() {
20
x = 1;
21
}
22
}
23
24
class
test {
25
static
int
x=8;
26
test() {
27
x = 9;
28
}
29
}
30
31
public
class
abstracts
{
32
static
int
z;
33
static
{
34
z = 3;
35
System.out.println(z);
// is called before main
36
}
37
public
static
void
main
(String[] args) {
38
animal[] a =
new
animal[10];
//support polymorphic array
39
//a[0] = new animal(); //error
40
a[0] =
new
dog();
41
a[0].mustbeoverriden();
42
a[1] =
new
cat
();
43
final
int
x;
44
x=1;
45
System.out.println(x);
46
bruh b =
new
bruh();
47
System.out.println(b.x);
48
final
int
y;
49
{
50
y = 1;
51
System.out.println(y);
52
}
53
System.out.println(test.x);
54
test t =
new
test();
55
System.out.println(t.x);
56
Integer pp = 100;
57
System.out.println(pp);
58
}
59
}
chapter7.abstracts
Definition
abstracts.java:31
chapter7.abstracts.main
static void main(String[] args)
Definition
abstracts.java:37
chapter7.cat
Definition
cat.java:3
chapter7.friendly
Definition
abstracts.java:13
chapter7.friendly.pet
void pet()
chapter7
abstracts.java
Generated on Sat Dec 7 2024 17:10:09 for COMP2396 by
1.12.0