Java Developer Interview Questions and Answers
1 Q: Say something about your technological skills.
2 Q: What are the key tasks of a Java Developer?
A: Creating complex web based applications, developing e-commerce sites that use collection of user information, writing and revising programs as per client requirements, producing weekly or monthly progress reports etc. are some key tasks of a Java Developer. But it is necessary to read the job description carefully so as to answer this question. Answer in a brief and keep it simple.
3 Q:. Mention five features of Java Programming Language.
A: The five features of Java Programming language are Platform Independent, Object oriented, multithreaded and Interactive and distributed. You can also describe about each feature. Do not make it very long. Just one line of each feature is enough.
4 Q: What is the difference between abstraction and encapsulation?
A: Abstraction is the ability to define an object that can represent abstract entities which can work, change state and communicate with other entities. Encapsulation is a mechanism by which you restrict the access to some of the object’s components, as well as binding the data and methods operating on data.
5 Q: What do you mean by infinite loop?
A: An infinite loop is a sequence of instructions in a computer program which loops endlessly, either due to the loop having no terminating condition, having one that can never be met, or one that causes the loop to start over.
6 Q: What is the difference between abstract class and interface in Java?
A: The main difference is methods of a Java interface are implicitly abstract and cannot have implementations. A Java abstract class can have an instance method that implements a default behavior. Variables declared in a Java interface is by default final. An abstract class may contain non final variables. Members of a Java interface are public by default. A Java abstract class can have the usual flavors of class members like private, protected etc.
7 Q:. When we should use serialization?
A: Serialization is the process of converting an object’s state to a sequence of bytes, as well as the process of rebuilding those bytes into a live object at some future time. Serialization is used to persist data for future use, to send data to a remote computer using such client/server Java technologies as RMI or socket programming, to flatten an object into array of bytes in memory and to send objects between the servers in a cluster.
8 Q:. What is the purpose of Static methods and static variables?
A: When there is a requirement to share a method or a variable between multiple objects of a class instead of creating separate copies for each object, we use static keyword to make a method or variable shared for all objects.
9 Q:. Describe synchronization in respect to multithreading.
A: With respect to multithreading, synchronization is the capability to control the access of multiple threads to shared resources. Without synchronization, it is possible for one thread to modify a shared variable while another thread is in the process of using or updating same shared variable. This usually leads to significant errors.
10 Q: What is static variable in Java?
A: A static variable is one that’s associated with a class, not objects of that class. Static means one per class, not one for each object no matter how many instance of a class might exist. This means that you can use them without creating an instance of a class. Static methods are implicitly final, because overriding is done based on the type of the object, and static methods are attached to a class, not an object.
11 Q:. What are the skills required for a Java Developer?
A: The skills generally required for a Java developer job includes analytical and problem solving skills, technical writing skills, effective communication, multitasking and time management, organization skills and interpersonal skills. Give examples where you demonstrated such skills so as to be thought of as a good fit for the job of a Java Developer.
12Q: What is an Iterator?
A: Some of the collection classes provide traversal of their contents via java.util.iterator interface. This interface allows you to walk through a collection of objects, operating on each object in turn. Iterators contain a snapshot of the collection at the time the Iterator was obtained; generally it is not advisable to modify the collection itself while traversing an Iterator.
13 Q: What is overriding?
A: When a class defines a method using the same name, return type, and arguments as a method in its superclass, the method in the class overrides the method in the superclass. When the method is invoked for an object of the class, it is the new definition of the method that is called and not the method definition from superclass. Methods may be overridden to be more public not more private.