order of initialization in Java
Posted
by M.H
on Stack Overflow
See other posts from Stack Overflow
or by M.H
Published on 2010-04-16T12:17:37Z
Indexed on
2010/04/16
12:23 UTC
Read the original article
Hit count: 243
java
Hi, I want to ask why java initializes the static objects before the non-static objects ?
in this example b3 will be initialized after b4 and b5 :
class Cupboard {
Bowl b3 = new Bowl(3);
static Bowl b4 = new Bowl(4);
Cupboard() {}
static Bowl b5 = new Bowl(5);
}
© Stack Overflow or respective owner