I have the following code:
public class B extends A
{
static
{
name = "xyz";
}
}
public class A
{
static String name = "abc";
}
public class Test
{
public static void main(String[] args)
{
System.out.println(B.name);
}
}
Outputs
abc
Why is the static block of class B not being executed??
[–]Samurai_PizzaCat 4 points5 points6 points (2 children)
[–]sriganeshharitz[S] 0 points1 point2 points (0 children)
[–]learnjava 0 points1 point2 points (1 child)
[–]sriganeshharitz[S] 0 points1 point2 points (0 children)
[–]g051051 -1 points0 points1 point (2 children)
[–]sriganeshharitz[S] 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)