| Real'sHowTo |
|
|
Custom Search
|
| Real'sHowTo |
|
|
Custom Search
|
public class Foo {
private static Bar b = new Bar();
...
}
class Bar {
public Bar ( ) throws Exception {
}
}
To solve this situation, use a static block.
public class Foo {
static Bar bar ;
static {
try {
bar = new Bar() ;
}
catch ( Exception e ) {
e.printStackTrace() ;
}
}
}
class Bar {
public Bar ( ) throws Exception {
}
}
Written and compiled by Réal Gagnon ©1998-2013
[ home ]