Can java object be locked down for exclusive use by a given thread?
Given: 10. interface A { void x(); } 11. class B implements A { public void x() { } public voidy() { } } 12. class C extends B { public void x() {} } And: 20. java.util.List list = new java.util.ArrayList(); 21. list.add(new B()); 22. list.add(new C()); 23. for (A a:list) { 24. a.x(); 25. a.y();; 26. } What is the result? 1 Compilation fails because of an error in line 25. 2 The code runs with no output. 3 An exception is thrown at runtime. 4 Compilation fails because of an error in line 20.
What is matcher in java?
When does the compiler supply a default constructor for a class?
printstream class method println() is calling using System class and its static object out .how it is explain any one in detail with example ?
What is difference between string and stringbuffer?
what is struts-config-xml?and its use?
What is persistence ?
Where is singleton pattern used?
What is set string?
How to prevent to create multiple objects of a java class?
Difference between current previous versions of Java?
Can we use a default constructor of a class even if an explicit constructor is defined?