Core Java Interview Questions
Questions Answers Views Company eMail

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

1 2876

what are the uses of Class class and what it returns? explain it with the example code.

1 3141

class test { private static void main(String []adsf) { } } explain me that the above code is error or exception

3 4291

class a extends b { } class b extends a { } why java doesn't support cyclic pls explain me with example

Wipro,

3 8771

how to create a jar file in java

1 4260

what is the main difference between string and stringbuffer? can you explain it with program?

2 4305

How can i add a button in applet in java ???

2 3467

did interface can implementation method ? i know its not possible but my interviewer said its possible ..but how..? any one have idea ???

IBM,

7 9121

how to make the double-tone class ? as we have singletone class..?

IBM, Microsoft,

1 4249

why constructor dont have returns type?

IBM,

9 11787

is JVM platform dependent or independent..?

IBM, Tech Mahindra,

11 37513

what is difference between interface and abstract class..?

4 5329

How to make a method thread safe without using synchronized keyword?

Persistent, Societe Generale,

8 31999

what is the collable collections in java?

Persistent,

2 11379

we have syntax like for(int var : arrayName) this syntax is to find whether a number is in the array or not.but i want to know how to find that number's location.

1560


Post New Core Java Questions

Un-Answered Questions { Core Java }

What is comparator in java?

545


What is the use of join method?

567


Program to Find the second largest element in an array.

578


How does system arraycopy work in java?

573


What is a numeric literal?

515






what is a thread pool in java and why is it used?

525


4.1 Supply contracts (in the form of comments specifying pre- and post conditions) for the enqueue() method of the LinkedQueue class given in the Appendix. (2) 4.2 Let Thing be a class which is capable of cloning objects, and consider the code fragment: Thing thing1 = new Thing(); //(1) Thing thing2 = thing1; //(2) Thing thing3 = (Thing) thing1.clone(); //(3) Explain how the objects thing2 and thing3 differ from each other after execution of the statements. (

1405


What is an array length?

492


How does split work in java?

526


Does a class inherit the constructors of its superclass in java programming?

517


How can a gui component handle its own events?

586


What is arraylist e?

553


What is anti pattern in cyber security?

515


How do you check if two given string are anagrams?

546


What is the largest data type in java?

504