Polymorphism is defined as the ability to take more than one form It is of two types namely, Compile time polymorphism or method overloading- a function called during compile java 7 certifications time. Based on the number of parameters it may calculate the area of a square, triangle, or circle. Run time polymorphism or method overriding- links during run time.

java developer interview questions

But, the main method will not be treated as the entry point to the application or the program. File uploads in a servlet can be handled using the Apache Commons FileUpload library. You can create a FileItemFactory object to create a disk-based or memory-based file item, and then use a ServletFileUpload object to parse the request and save the uploaded file.

Differentiate between the Singly Linked List and Doubly Linked List.

The only difference between them is on their syntax no functionality difference is present between them. There are two types of arrays i.e., Primitive arrays and References Arrays. Mainly used to delay a thread for some specific time duration. Print, println, and printf all are used for printing the elements but print prints all the elements and the cursor remains in the same line. In Java, the FileOutputStream function is used to write data byte by byte into a given file or file descriptor.

java developer interview questions

Certain methods of Iterator are next(), remove(), and hasNext(). Can’t add elements, and also throws ConcurrentModificationException. Can traverse elements present in Collection both in forward and backward directions. Can traverse elements present in Collection only in the forward direction.

Can you discuss your experience with database management and ORM (Object-Relational Mapping) in Java applications?

Inheritance represents the IS-A relationship which is also known as a parent-child relationship. The Java Runtime Environment is a set of software tools which are used for developing Java applications. It contains a set of libraries + other files that JVM uses at runtime. Java provides built-in support for multithreaded programming. The main thread is considered the parent thread of all the other threads that are created during the program execution. The main thread is automatically created when the program starts running.

  • The system is established as the last line to be run, after which nothing will happen, therefore both the catch and finally blocks are essentially ignored.
  • No, Java cannot be treated as a complete object-oriented programming language.
  • Marker interfaces are purely a convention and serve as a form of metadata.
  • That is why you need to add this to your Java developer interview questions list.

The given print statement will throw a java.lang.NullPointerException because the OR logical operator evaluates both the literals before returning the result. Since str is null, the .equals() method will throw an exception. Its always advisable to use short-circuit logical operators, such as || and &&, which evaluate the literal values from left to right. In this case, since the first literal would return true, it would skip the second literal evaluation. This code results in an infinite loop if the flag is true and the program exists if the flag is false. All the string manipulation methods return a new string, which is why you need to assign it to another variable.

Q104. What are the life-cycle methods for a jsp?

Since Constructors are invoked only when the object is created, there is no sense to make the constructors static. However, if you try to do so, the compiler will show the compiler error. The Object is the real-time entity having some state and behavior.

Java is one of the top three most desirable programming languages. With the rise of the era of applications comes the increase in demand for Java developers. It is becoming more and more difficult to hire competent and experienced developers. The applicant lacks knowledge of the two memory allocation methods if the candidate can’t give a definite answer on the difference between heap and stack. Java is not purely object-oriented because it uses primitive data types that are not objects.

The FailFast iterators tend to fail and throw an exception called ConcurrentModificationException. The Observer interface gets implemented by objects that observe Observable objects. The Externalizable interface helps with control over the process of serialization. An “externalisable” interface incorporates readExternal and writeExternal methods.

  • The subclass overridden method can only specify unchecked exceptions if the superclass method does not declare any exceptions.
  • – Providing hints to the Java runtime or frameworks about special handling or optimizations for certain classes.
  • The HashSet class implements the Set interface in the Java Collections Framework and is a member of the HashSet class.