Follow Our FB Page << CircleMedia.in >> for Daily Laughter. We Post Funny, Viral, Comedy Videos, Memes, Vines...

Core Java Interview Questions
Questions Answers Views Company eMail

IS method overriding is Duplication of Methods?

CybAge,

5 7403

10. class Nav{ 11. public enum Direction { NORTH, SOUTH, EAST, WEST } 12. } 13. public class Sprite{ 14. // insert code here 15. } Which code, inserted at line 14, allows the Sprite class to compile? a)Direction d = NORTH; b)Nav.Direction d = NORTH; c)Direction d = Direction.NORTH; d)Nav.Direction d = Nav.Direction.NORTH;

2 11496

33. try { 34. // some code here 35. } catch (NullPointerException e1) { 36. System.out.print(”a”); 37. } catch (RuntimeException e2) { 38. System.out.print(”b”); 39. } finally { 40. System.out.print(”c”); 41. } What is the result if a NullPointerException occurs on line 34? 1 c 2 a 3 ab 4 ac

5 11365

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.

3 15507

11. static class A { 12. void process() throws Exception { throw new Exception(); } 13. } 14. static class B extends A { 15. void process() { System.out.println(”B”); } 16. } 17. public static void main(String[] args) { 18. new B().process(); 19. } What is the result? 1 B 2 The code runs with no output. 3 Compilation fails because of an error in line 12. 4 Compilation fails because of an error in line 15.

6 13202

84. try { 85. ResourceConnection con = resourceFactory.getConnection(); 86. Results r = con.query(”GET INFO FROM CUSTOMER”); 87. info = r.getData(); 88. con.close(); 89. } catch (ResourceException re) { 90. errorLog.write(re.getMessage()); 91. } 92. return info; Which is true if a ResourceException is thrown on line 86? 1 Line 92 will not execute. 2 The connection will not be retrieved in line 85. 3 The resource connection will not be closed on line 88. 4 The enclosing method will throw an exception to its caller.

1 8057

Given: 1. package test; 2. 3. class Target { 4. public String name = “hello”; 5. } What can directly access and change the value of the variable name? 1 any class 2 only the Target class 3 any class in the test package 4 any class that extends Target

Infosys, WW,

7 15956

Given: 11. public static void main(String[] args) { 12. Integer i = uew Integer(1) + new Integer(2); 13. switch(i) { 14. case 3: System.out.println(”three”); break; 15. default: System.out.println(”other”); break; 16. } 17. } ‘What is the result? 1 three 2 other 3 An exception is thrown at runtime. 4 Compilation fails because of an error on line 12.

9 11219

which is advanced deep technology in java launched by the sun microsystem??? The answer is very logical If u need correct answer mail me at priya_gupta@gmail.com

IBM,

2865

I need some details about an employee. i have only the employee id in my presentation layer(JSP).I entered that ID and click "Show Details" Button. Question is how the JSP pass that id to Controller layer and DAO and what mechanism we are using to retrive data from DB and how the data passed to JSP as a Output. Please explain in detail.

TCS,

1 3992

My application URL : http://localhost:8080/Application/Login.jsp. When a user enter this url in IE then, how it get Login.JSP Page exactly? what are the processes will happen from when we submit the URL to get Login.jsp?

IBM, TCS,

3 35976

What is Three tier architecture. Can anyone explain with a Ordinary web application Project? (JSP,Servlets,JAVA,DAO) ?

TCS,

3 9787

We can write any Java Logics in our JSP. Then why we are using servlets(Controller Layer) to interact with the DAO ?

TCS,

6 7984

Accenture NJ mostly ask question on Collection like 1)How to sort Objcts and how treeset sort them 2)Explain mechanism of Hashcode finding in Java 3)Name some of the Sorted collection.

Accenture,

2 6450

could you run the java program without main method?

6 12546


Post New Core Java Questions






Un-Answered Questions { Core Java }

What is difference between stringbuffer and string?

179


Which class contains a method: cloneable or object?

214


How do you control extraneous variables?

170


Is arraylist a class in java?

160


What are the object and class classes used for?

198






How objects are stored in java?

209


Is string pool garbage collected?

175


How big is a pointer?

180


What does I ++ mean?

174


Can we sort a map in java?

198


What is a heavyweight component?

189


Is list ordered in java?

177


What happens if constructor is private?

175


Is it correct to say that due to garbage collection feature in java, a java program never goes out of memory?

228


What collections you have worked on? Internal working of Hashmap?

1456