Originally posted by Balamurugan Kandasamy:
The following compiles.
import java.lang.*;
public class A {
[b]static class B {}
}
class C extends A.B {
public static void main(String args[])
{
A.B ab = new A().new B();
}
}
But when I remove static for class B which is as below , it says
no enclosing instance of type A in scope.
import java.lang.*;
However if i dont extend A.B then it is not a problem.public class A {
class B {} // note than static is removed.
}
class C extends A.B {
public static void main(String args[])
{
A.B ab = new A().new B();
}
}
import java.lang.*;
public class A {
static class B {}
}
class D {
public static void main(String args[])
{
A.B ab = new A().new B();
}
}
Think im not clear in this funda. Pls throw some light.
Thanks
MKBala...[/B]
Originally posted by William Brogden:
The "main thread" is just the Thread used to execute the main method. It can easily start other threads and then die.
A Java application runs until either:
1) all user Threads are finished
2) The System.exit() method is called.
There is nothing magic about the "main" thread.
Bill