Sei sulla pagina 1di 4

BASIC JAVA ASSESSMENT QUESTIONS

1) Difference between an abstract class and interface


2) Inner classes
3) Difference between an inner class and a normal class

BASIC JAVA ASSESSMENT QUESTIONS

1. What are the differences between a List and a Set?


2. What are value objects and how are they used with EJBs?
3. How do you code a Singleton in Java?
4. What's a dynamic proxy class?
5. When should you call SwingUtilities.invokeLater()?
6. What are the differences between a Session Bean and an Entity Bean?
7. How do you read an XML file in Java?
8. Give an example of the Decorator pattern in the Java API.

seriously, here are some real technical interview questions from a list used by a large multinational
for an entry level Java or C++ programmer

- explain protected vs private vs public data members and methods


- explain overloading and overriding
- what is polymorphism
- what is inheritance
- what is encapsulation
- give an example of where you might use a static method
- explain up casting and down casting
- what is an abstract class
- explain multiple inheritance and interfaces
- if you have a tree of derived classes, what order are the constructors run
- how do you deal with errors
Top Java interview questions
Comments: 0 - Date: January 3rd, 2007 - Categories: Interviews, Java

1. How do I instantiate a bean whose constructor accepts parameters using the


useBean tag?
2. Replacing Characters in a String?
3. Searching a String?
4. Connecting to a Database and Strings Handling?
5. What is a transient variable?
6. What is the difference between Serializalble and Externalizable interface?
7. How many methods in the Externalizable interface?
8. How many methods in the Serializable interface?
9. How to make a class or a bean serializable?
10. What is the serialization?
11. What are synchronized methods and synchronized statements?
12. What is synchronization and why is it important?
13. What is the purpose of finalization?
14. What classes of exceptions may be caught by a catch clause?
15. What is the difference between the Reader/Writer class hierarchy and the
InputStream/OutputStream class hierarchy?
16. What happens when a thread cannot acquire a lock on an object?
17. What restrictions are placed on method overriding?
18. What restrictions are placed on method overloading?
19. How does multithreading take place on a computer with a single CPU?
20. How is it possible for two String objects with identical values not to be equal
under the == operator?
21. How are this() and super() used with constructors?
22. What class allows you to read objects directly from a stream?
23. What is the ResourceBundle class?
24. What interface must an object implement before it can be written to a stream as an
object?
25. What is Serialization and deserialization?
26. What are the Object and Class classes used for?
27. Can you write Java code for declaration of multiple inheritance in Java ?
28. What do you mean by multiple inheritance in C++ ?
29. Write the Java code to declare any constant (say gravitational constant) and to get
its value.
30. What are the disadvantages of using threads?
31. Given two tables Student(SID, Name, Course) and Level(SID, level) write the
SQL statement to get the name and SID of the student who are taking course = 3
and at freshman level.
32. What do you mean by virtual methods?
33. What do you mean by static methods?
34. What do mean by polymorphism, inheritance, encapsulation?
35. What are the advantages of OOPL?
36. How many methods do u implement if implement the Serializable Interface?
37. Are there any other ‘marker’ interfaces?
38. What is the difference between instanceof and isInstance?
39. Why do you create interfaces, and when MUST you use one?
40. What’s the difference between the == operator and the equals() method? What test
does Object.equals() use, and why?
41. Discuss the differences between creating a new class, extending a class and
implementing an interface; and when each would be appropriate.
42. Given a text file, input.txt, provide the statement required
43. Name four methods every Java class will have.
44. What does the “abstract” keyword mean in front of a method? A class?
45. Does Java have destructors?
46. Are constructors inherited? Can a subclass call the parent’s class constructor?
When?
47. What synchronization constructs does Java provide? How do they work?
48. Why “bytecode”? Can you reverse-engineer the code from bytecode?
49. Does Java have “goto”?
50. What does the “final” keyword mean in front of a variable? A method? A class?
51. Access specifiers: “public”, “protected”, “private”, nothing?
52. What is JDBC? Describe the steps needed to execute a SQL query using JDBC.
53. What is RMI?
54. What are native methods? How do you use them?
55. What does the keyword “synchronize” mean in java. When do you use it? What
are the disadvantages of synchronization?
56. How many different types of JDBC drivers are present? Discuss them.
57. What is the difference between a Vector and an Array. Discuss the advantages and
disadvantages of both?
58. Describe java’s security model.
59. Java says “write once, run anywhere”. What are some ways this isn’t quite true?
60. What is the difference between an Applet and an Application?
61. How can you force all derived classes to implement a method present in the base
class?
62. What are abstract classes, abstract methods?
63. What’s the difference between == and equals method?
64. Describe, in general, how java’s garbage collector works?
65. What is the difference between StringBuffer and String class?
66. How can you achieve Multiple Inheritance in Java?
67. What are interfaces?
68. What are the main differences between Java and C++?
69. In Java, You can create a String object as: String str = “abc”; & String str = new
String(”abc”); Why cant a button object be created as : Button bt = “abc” Why is
it compulsory to create a button object as: Button bt = new Button(”abc”); Why is
this not compulsory in String’s case?
70. Why are Java ARchive (JAR) files important?
71. What is it reflection (introspection) ? Why is reflection possible in the Java
language?
72. How to make application thread-safe ?
73. What is it object serialization?
74. What do you know about networking support in Java?
75. What you know about Corba implementation in Java?
76. What is Java Beans?
77. Compare SWING components to standard AWT.
78. What is layout manager ? How does it work?
79. What is the purpose of the toolkit in the Abstract Window Toolkit (AWT)? How
does AWT work?
80. What are the differences between Java & C++ in terms of its features?
81. Is the ternary operator written x : y ? z or x ? y : z ?
82. What is the List interface?
83. What is the difference between an if statement and a switch statement?
84. What are the problems faced by Java programmers who don’t use
layoutmanagers?
85. What are the two basic ways in which classes that can be run as threads may be
defined?
86. What are synchronized methods and synchronized statements?
87. Which Component subclass is used for drawing and painting?
88. What methods are used to get and set the text label displayed by a Buttonobject?
89. What method must be implemented by all threads?
90. When is an object subject to garbage collection?
91. Can an unreachable object become reachable again?
92. How does a try statement determine which catch clause should be used tohandle
an exception?
93. What are the Object and Class classes used for?
94. What modifiers may be used with a top-level class?
95. What is a Java package and how is it used?
96. What is the purpose of a statement block?
97. What is the difference between the prefix and postfix forms of the ++ operator?
98. Can try statements be nested?
99. To what value is a variable of the boolean type automatically initialized?
100.What is the difference between a public and a non-public class?

Potrebbero piacerti anche