hi to all,i have a question on static block.
i saved below as test.java
class test extends a
{
static {
System.out.println("test static");
}
public static void main(String []dfs)
{
}
}
class a
{
static
{
System.out.println("a static");
}
public static void main(String []asdf)
{
}
}
o/p
as static
test static
but if i change base class as test class then
class test
{
static {
System.out.println("test static");
}
public static void main(String []dfs)
{
}
}
class a extends test
{
static
{
System.out.println("a static");
}
public static void main(String []asdf)
{
}
}
o/p
test static
explain me why "a static" wasn't print in second code when
it is in derived class
just chek again ur code
class test extends a
{
static {
System.out.println("test static");
}
public static void main(String []dfs)
{
}
}
class a
{
static
{
System.out.println("a static");
}
public static void main(String []asdf)
{
}
}
it;s genrate the o/p
a static
class test
{
static {
System.out.println("test static");
}
public static void main(String []dfs)
{
}
}
class a extends test
{
static
{
System.out.println("a static");
}
public static void main(String []asdf)
{
}
}
test static
a static
ok jst analyze ur problem thn contact me
ashish.gupta126126@gmail.com
Is This Answer Correct ? | 0 Yes | 2 No |
there are N number of matchboxes numbered 1...N.each matchbox contain various number of stick.Two player can alternatevely pick some amount of stick from the higest stick containing box . The player is condidered win if there is no stick after his move.Find the final move so that the move player win. Note:In case the number of stick is equal ,pick the stick from the higest numbered box.
What is the difference between serialization and deserialization?
1.what is the exact difference between applet and frame? 2.Do we use main method in frames?
How can a class be accessed, If no access modifiers are declared?
What is the difference between Integer and int?
Does collectionutils isempty check for null?
Is a string literal?
What is the difference between static and non-static variables?
What is the difference between I ++ and ++ I in java?
What is the difference between the paint() and repaint() methods in java programming?
Is there a sort function in java?
What is the output of the following Java program? class Main { public static void main(String args[]){ final int i; i = 10; System.out.println(i); } } 10. What is the output of the following Java program? class Main { public static void main(String args[]){ final int i; i = 10; System.out.println(i); } }