J. Scott

Greenhorn
+ Follow
since Mar 16, 2000
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by J. Scott

I passed the SCJP2 last night with an 85%.
I want to thank everyone involved with this site for all of your help. This site has been a great resource!
I want to especially thank Paul, Jim, Maha Anna and Tony for all of the challenging questions and thorough/concise explanations.
Great garbage collection question. It has inspired a follow up question concerning the same topic:
Can garbage collection ensure that a program will not run out of memory while running?
This compiles, therefore answer "C" is true. (the code doesn't format well in this window; so please excuse the poor coding structure)
class Counter {
public static void main(String[] args) {
Thread t = new Thread(new CounterBehavior());
t.start();
}
static class CounterBehavior implements Runnable {
public void run() {
try {
for (int i = 1; i <= 100; i++){
System.out.println(i); Thread.sleep(1000);
}
} catch (InterruptedException x) {}
}
}}
Can't a static inner class also technically be considered a top-level class? Then the static inner/top-level class would have access to the outer class's static variables. If this is true then I think answer "C" is correct.
Not sure. I am still very new to Java, but would be interested in knowing if the above makes sense.