{"id":25509163,"date":"2022-02-10T12:07:34","date_gmt":"2022-02-10T06:37:34","guid":{"rendered":"https:\/\/entri.app\/blog\/?p=25509163"},"modified":"2023-01-10T14:38:23","modified_gmt":"2023-01-10T09:08:23","slug":"java-interview-questions-and-answers","status":"publish","type":"post","link":"https:\/\/entri.app\/blog\/java-interview-questions-and-answers\/","title":{"rendered":"Java Interview Questions And Answers For 2023"},"content":{"rendered":"<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_79_2 counter-hierarchy ez-toc-counter ez-toc-custom ez-toc-container-direction\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<label for=\"ez-toc-cssicon-toggle-item-69e5ecebe6f0d\" class=\"ez-toc-cssicon-toggle-label\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/label><input type=\"checkbox\"  id=\"ez-toc-cssicon-toggle-item-69e5ecebe6f0d\"  aria-label=\"Toggle\" \/><nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/entri.app\/blog\/java-interview-questions-and-answers\/#Interview_For_Java_2023\" >Interview For Java 2023<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/entri.app\/blog\/java-interview-questions-and-answers\/#Popular_Java_Interview_Questions_and_Answers\" >Popular Java Interview Questions and Answers<\/a><\/li><\/ul><\/nav><\/div>\n<p><span style=\"font-weight: 400;\">If you are planning to make a career in the programming language of Java then you must also have proper specifications related to the interview and other selection procedures which is presented by the organisations in which you want to get a job. You can also take into consideration some model interviews in order to be prepared for the questions which will be asked when you are giving an interview inside any prestigious organisation. Given below, we are sharing some of the most important specifications related to the Java Interview Questions and Answers for 2023.\u00a0<\/span><\/p>\n<p style=\"text-align: center;\"><a href=\"https:\/\/entri.sng.link\/Bcofz\/uu8c\/w409\" target=\"_blank\" rel=\"noopener\"><strong>Click on the link here to take a crash course for Java<\/strong><\/a><\/p>\n<h2><span class=\"ez-toc-section\" id=\"Interview_For_Java_2023\"><\/span><b>Interview For Java 2023<\/b><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p><span style=\"font-weight: 400;\">Java is one of the most simple high-level languages present around the globe and it has powerful tools which are very popular. This language has a lot of use and that&#8217;s why a lot of people are developing their careers surrounding this language. Getting a career in one of the most popular programming languages can be a tough task but you can crack the interview once you have the details related to the questions and the type of interview that you will be going through. You can check out some of the most popular questions asked in the Java interview given below.\u00a0<\/span><\/p>\n<h2><span class=\"ez-toc-section\" id=\"Popular_Java_Interview_Questions_and_Answers\"><\/span><b>Popular Java Interview Questions and Answers<\/b><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<h3><b>1. Is Java a platform-independent language?<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">Java language was developed in such a way that it does not depend on any hardware or software due to the fact that the compiler compiles the code and then converts it to platform-independent byte code which can be run on multiple systems.<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">The only condition to run that byte code is for the machine to have a runtime environment (JRE) installed in it.<\/span><\/li>\n<\/ul>\n<h3><b>2. Is Java a pure object-oriented language?<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">Java supports primitive data types &#8211; byte, boolean, char, short, int, float, long, and double and hence it is not a pure object-oriented language.<\/span><\/p>\n<h3><b>3. Pointers are used in C\/ C++. Does Java not make use of pointers? If not then why?<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">Pointers are quite complicated and unsafe to use by beginner programmers. Java focuses on code simplicity, and the usage of pointers can make it challenging. Pointer utilization can also cause potential errors. Moreover, security is also compromised if pointers are used because the users can directly access memory with the help of pointers. Thus, a certain level of abstraction is furnished by not including pointers in Java. Moreover, the usage of pointers can make the procedure of garbage collection quite slow and erroneous. Java makes use of references as these cannot be manipulated, unlike pointers.<\/span><\/p>\n<h3><b>4. Explain instance variable and a local variable?<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">Instance variables are those variables that are accessible by all the methods in the class. They are declared outside the methods and inside the class. These variables describe the properties of an object and remain bound to it at any cost. All the objects of the class will have their copy of the variables for utilization. If any modification is done on these variables, then only that instance will be impacted by it, and all other class instances continue to remain unaffected. Local variables are those variables present within a block, function, or constructor and can be accessed only inside them. The utilization of the variable is restricted to the block scope. Whenever a local variable is declared inside a method, the other class methods don\u2019t have any knowledge about the local variable.<\/span><\/p>\n<h3><b>5. Explain data encapsulation?<\/b><\/h3>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Data Encapsulation is an Object-Oriented Programming concept of hiding the data attributes and their behaviours in a single unit.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">It helps developers to follow modularity while developing software by ensuring that each object is independent of other objects by having its own methods, attributes, and functionalities.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">It is used for the security of the private properties of an object and hence serves the purpose of data hiding.<\/span><\/li>\n<\/ul>\n<h3><b>6. Explain the JIT compiler.<\/b><\/h3>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">JIT stands for Just-In-Time and it is used for improving the performance during run time. It does the task of compiling parts of byte code having similar functionality at the same time thereby reducing the amount of compilation time for the code to run.<\/span><\/li>\n<\/ul>\n<h3><b>7. Diffrentiate between the equals() method and equality operator (==) in Java?<\/b><\/h3>\n<table>\n<tbody>\n<tr>\n<td><b>equals()\u00a0<\/b><\/td>\n<td><b>==<\/b><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">This is a method defined in the Object class.\u00a0<\/span><\/td>\n<td><span style=\"font-weight: 400;\">It is a binary operator in Java.<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">This method is used for checking the equality of contents between two objects as per the specified business logic.<\/span><\/td>\n<td><span style=\"font-weight: 400;\">This operator is used for comparing addresses (or references), i.e checking if both the objects are pointing to the same memory location.<\/span><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3><b>8. Elaborate infinite loop declared in Java?<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">Infinite loops are those loops that run infinitely without any breaking conditions. Some examples of consciously declaring infinite loop is:<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Using For Loop:<\/span><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400;\">for (;;)<\/span><\/p>\n<p><span style=\"font-weight: 400;\">{<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\/\/ Business logic<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\/\/ Any break logic<\/span><\/p>\n<p><span style=\"font-weight: 400;\">}<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Using while loop:<\/span><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400;\">while(true){<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\/\/ Business logic<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\/\/ Any break logic<\/span><\/p>\n<p><span style=\"font-weight: 400;\">}<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Using do-while loop:<\/span><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400;\">do{<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\/\/ Business logic<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\/\/ Any break logic<\/span><\/p>\n<p><span style=\"font-weight: 400;\">}while(true);<\/span><\/p>\n<h3><b>9. Elaborate the concept of constructor overloading<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">Constructor overloading is the process of creating multiple constructors in the class consisting of the same name with a difference in the constructor parameters. Depending upon the number of parameters and their corresponding types,\u00a0<\/span><\/p>\n<h3><b>10. Explain method overloading and overriding by citing relevant examples.<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">In Java, method overloading is made possible by introducing different methods in the same class consisting of the same name. Still, all the functions differ in the number or type of parameters. It takes place inside a class and enhances program readability. Method overriding is the concept in which two methods having the same method signature are present in two different classes in which an inheritance relationship is present. A particular method implementation (already present in the base class) is possible for the derived class by using method overriding.<\/span><\/p>\n<h3><b>11. A single try block and multiple catch blocks can co-exist in a Java Program. Explain.<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">Yes, multiple catch blocks can exist but specific approaches should come prior to the general approach because only the first catch block satisfying the catch condition is executed.<\/span><\/p>\n<h3><b>12. What is the use of the final keyword in variable, method and class.<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">In Java, the final keyword is used as defining something as constant \/final and represents the non-access modifier.<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">final variable:<\/span>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"2\"><span style=\"font-weight: 400;\">When a variable is declared as final in Java, the value can\u2019t be modified once it has been assigned.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"2\"><span style=\"font-weight: 400;\">If any value has not been assigned to that variable, then it can be assigned only by the constructor of the class.<\/span><\/li>\n<\/ul>\n<\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">final method:<\/span>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"2\"><span style=\"font-weight: 400;\">A method declared as final cannot be overridden by its children&#8217;s classes.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"2\"><span style=\"font-weight: 400;\">A constructor cannot be marked as final because whenever a class is inherited, the constructors are not inherited. Hence, marking it final doesn&#8217;t make sense. Java throws compilation error saying &#8211; modifier final not allowed here<\/span><\/li>\n<\/ul>\n<\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">final class:<\/span>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"2\"><span style=\"font-weight: 400;\">No classes can be inherited from the class declared as final. But that final class can extend other classes for its usage.<\/span><\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<h3><b>13. Do final, finally and finalize keywords have the same function?<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">All three keywords have their own utility while programming.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Final: If any restriction is required for classes, variables, or methods, the final keyword comes in handy. Inheritance of a final class and overriding of a final method is restricted by the use of the final keyword. The variable value becomes fixed after incorporating the final keyword. Example:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">final int a=100;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">a = 0;\u00a0 \/\/ error<\/span><\/p>\n<p><span style=\"font-weight: 400;\">The second statement will throw an error.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Finally: It is the block present in a program where all the codes written inside it get executed irrespective of handling of exceptions.\u00a0<\/span><\/p>\n<h3><b>14. When can you use the super keyword?<\/b><\/h3>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">The super keyword is used to access hidden fields and overridden methods or attributes of the parent class.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Following are the cases when this keyword can be used:<\/span>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"2\"><span style=\"font-weight: 400;\">Accessing data members of parent class when the member names of the class and its child subclasses are same.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"2\"><span style=\"font-weight: 400;\">To call the default and parameterized constructor of the parent class inside the child class.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"2\"><span style=\"font-weight: 400;\">Accessing the parent class methods when the child classes have overridden them.<\/span><\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<h3><b>15. Can the static methods be overloaded?<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">Yes! There can be two or more static methods in a class with the same name but differing input parameters.<\/span><\/p>\n<h3><b>16. Can the static methods be overridden?<\/b><\/h3>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">No! Declaration of static methods having the same signature can be done in the subclass but run time polymorphism can not take place in such cases.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Overriding or dynamic polymorphism occurs during the runtime, but the static methods are loaded and looked up at the compile time statically. Hence, these methods cant be overridden.<\/span><\/li>\n<\/ul>\n<h3><b>17. What is the main objective of garbage collection?<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">The main objective of this process is to free up the memory space occupied by the unnecessary and unreachable objects during the Java program execution by deleting those unreachable objects.<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">This ensures that the memory resource is used efficiently, but it provides no guarantee that there would be sufficient memory for the program execution.<\/span><\/li>\n<\/ul>\n<h3><b>18. What part of memory &#8211; Stack or Heap &#8211; is cleaned in the garbage collection process?<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">Heap.<\/span><\/p>\n<h3><b>19. Apart from the security aspect, what are the reasons behind making strings immutable in Java?<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">A String is made immutable due to the following reasons:<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">String Pool: Designers of Java were aware of the fact that the String data type is going to be majorly used by the programmers and developers. Thus, they wanted optimization from the beginning. They came up with the notion of using the String pool (a storage area in Java heap) to store the String literals. They intended to decrease the temporary String object with the help of sharing. An immutable class is needed to facilitate sharing. The sharing of the mutable structures between two unknown parties is not possible. Thus, immutable Java String helps in executing the concept of String Pool.<\/span><\/li>\n<\/ul>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Multithreading: The safety of threads regarding the String objects is an important aspect in Java. No external synchronization is required if the String objects are immutable. Thus, a cleaner code can be written for sharing the String objects across different threads. The complex process of concurrency is facilitated by this method.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Collections: In the case of Hashtables and HashMaps, keys are String objects. If the String objects are not immutable, then they can get modified during the period when it resides in the HashMaps. Consequently, the retrieval of the desired data is not possible. Such changing states pose a lot of risks. Therefore, it is quite safe to make the string immutable.<\/span><\/li>\n<\/ul>\n<h3><b>20. Differentiate between a String, StringBuffer, and a StringBuilder?<\/b><\/h3>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Storage area: In string, the String pool serves as the storage area. For StringBuilder and StringBuffer, heap memory is the storage area.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Mutability: A String is immutable, whereas both the StringBuilder and StringBuffer are mutable.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Efficiency: It is quite slow to work with a String. However, StringBuilder is the fastest in performing operations. The speed of a StringBuffer is more than a String and less than a StringBuilder. (For example, appending a character is fastest in StringBuilder and very slow in String because a new memory is required for the new String with appended character.)<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Thread-safe: In the case of a threaded environment, StringBuilder and StringBuffer are used whereas a String is not used. However, StringBuilder is suitable for an environment with a single thread, and a StringBuffer is suitable for multiple threads.<\/span><\/li>\n<\/ul>\n<h3><b>21. Elaborate on the differences between interfaces and abstract classes.<\/b><\/h3>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Availability of methods: Only abstract methods are available in interfaces, whereas non-abstract methods can be present along with abstract methods in abstract classes.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Variable types: Static and final variables can only be declared in the case of interfaces, whereas abstract classes can also have non-static and non-final variables.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Inheritance: Multiple inheritances are facilitated by interfaces, whereas abstract classes do not promote multiple inheritances.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Data member accessibility: By default, the class data members of interfaces are of the public- type. Conversely, the class members for an abstract class can be protected or private also.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Implementation: With the help of an abstract class, the implementation of an interface is easily possible. However, the converse is not true;<\/span><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400;\">Abstract class example:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">public abstract class Athlete {<\/span><\/p>\n<p><span style=\"font-weight: 400;\">public abstract void walk();<\/span><\/p>\n<p><span style=\"font-weight: 400;\">}<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Interface example:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">public interface Walkable {<\/span><\/p>\n<p><span style=\"font-weight: 400;\">void walk();<\/span><\/p>\n<p><span style=\"font-weight: 400;\">}<\/span><\/p>\n<h3><b>22. In Java, static as well as private method overriding is possible. Comment on the statement.<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">The statement in the context is completely False. The static methods have no relevance with the objects, and these methods are of the class level. In the case of a child class, a static method with a method signature exactly like that of the parent class can exist without even throwing any compilation error. The phenomenon mentioned here is popularly known as method hiding, and overriding is certainly not possible. Private method overriding is unimaginable because the visibility of the private method is restricted to the parent class only. As a result, only hiding can be facilitated and not overrode.<\/span><\/p>\n<h3><b>23. What is the difference between HashSet different from a TreeSet?<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">Although both HashSet and TreeSet are not synchronized and ensure that duplicates are not present, there are certain properties that distinguish a HashSet from a TreeSet.<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Implementation: For a HashSet, the hash table is utilized for storing the elements in an unordered manner. However, TreeSet makes use of the red-black tree to store the elements in a sorted manner.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Complexity\/ Performance: For adding, retrieving, and deleting elements, the time amortized complexity is O(1) for a HashSet. The time complexity for performing the same operations is a bit higher for TreeSet and is equal to O(log n). Overall, the performance of HashSet is faster in comparison to TreeSet.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Methods: hashCode() and equals() are the methods utilized by HashSet for making comparisons between the objects. Conversely, compareTo() and compare() methods are utilized by TreeSet to facilitate object comparisons.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Objects type: Heterogeneous and null objects can be stored with the help of HashSet. In the case of a TreeSet, a runtime exception occurs while inserting heterogeneous objects or null objects.<\/span><\/li>\n<\/ul>\n<h3><b>24. Why is the character array preferred over string for storing confidential information?<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">In Java, a string is basically immutable i.e. it cannot be modified. After its declaration, it continues to stay in the string pool as long as it is not removed in the form of garbage. In other words, a string resides in the heap section of the memory for an unregulated and unspecified time interval after string value processing is executed. As a result, vital information can be stolen for pursuing harmful activities by hackers if a memory dump is illegally accessed by them. Such risks can be eliminated by using mutable objects or structures like character arrays for storing any variable. After the work of the character array variable is done, the variable can be configured to blank at the same instant. Consequently, it helps in saving heap memory and also gives no chance to the hackers to extract vital data.<\/span><\/p>\n<h3><b>25. Explain JVM, JRE and JDK in Java?<\/b><\/h3>\n<table>\n<tbody>\n<tr>\n<td><b>Criteria<\/b><\/td>\n<td><b>JDK\u00a0<\/b><\/td>\n<td><b>JRE<\/b><\/td>\n<td><b>JVM<\/b><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">Abbreviation<\/span><\/td>\n<td><span style=\"font-weight: 400;\">Java Development Kit<\/span><\/td>\n<td><span style=\"font-weight: 400;\">Java Runtime Environment<\/span><\/td>\n<td><span style=\"font-weight: 400;\">Java Virtual Machine<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">Definition<\/span><\/td>\n<td><span style=\"font-weight: 400;\">JDK is a complete software development kit for developing Java applications. It comprises JRE, JavaDoc, compiler, debuggers, etc.<\/span><\/td>\n<td><span style=\"font-weight: 400;\">JRE is a software package providing Java class libraries, JVM and all the required components to run the Java applications.<\/span><\/td>\n<td><span style=\"font-weight: 400;\">JVM is a platform-dependent, abstract machine comprising of 3 specifications &#8211; a document describing the JVM implementation requirements, computer program meeting the JVM requirements and instance object for executing the Java byte code and providing the runtime environment for execution.<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">Main Purpose<\/span><\/td>\n<td><span style=\"font-weight: 400;\">JDK is mainly used for code development and execution.<\/span><\/td>\n<td><span style=\"font-weight: 400;\">JRE is mainly used for environment creation to executing the code.<\/span><\/td>\n<td><span style=\"font-weight: 400;\">JVM provides specifications for all the implementations to JRE.<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">Tools provided<\/span><\/td>\n<td><span style=\"font-weight: 400;\">JDK provides tools like a compiler, debuggers, etc for code development<\/span><\/td>\n<td><span style=\"font-weight: 400;\">JRE provides libraries and classes required by JVM to run the program.<\/span><\/td>\n<td><span style=\"font-weight: 400;\">JVM does not include any tools, but instead, it provides the specification for implementation.<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">Summary<\/span><\/td>\n<td><span style=\"font-weight: 400;\">JDK = (JRE) + Development tools<\/span><\/td>\n<td><span style=\"font-weight: 400;\">JRE = (JVM) + Libraries to execute the application<\/span><\/td>\n<td><span style=\"font-weight: 400;\">JVM = Runtime environment to execute Java byte code.<\/span><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3><b>26. What are the differences between HashMap and Hashtable in Java?<\/b><\/h3>\n<table>\n<tbody>\n<tr>\n<td><b>HashMap<\/b><\/td>\n<td><b>Hashtable<\/b><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">HashMap is not synchronized thereby making it better for non-threaded applications.<\/span><\/td>\n<td><span style=\"font-weight: 400;\">HashTable is synchronized and hence it is suitable for threaded applications.<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">Allows only one null key but any number of null in the values.<\/span><\/td>\n<td><span style=\"font-weight: 400;\">This does not allow null in both keys or values.<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">Supports order of insertion by making use of its subclass LinkedHashMap.<\/span><\/td>\n<td><span style=\"font-weight: 400;\">Order of insertion is not guaranteed in HashTable.<\/span><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3><b>27. What is the importance of reflection in Java?<\/b><\/h3>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">The term reflection is used for describing the inspection capability of a code on other code either of itself or of its system and modifying it during runtime.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Consider an example where we have an object of unknown type and we have a method \u2018fooBar()\u2019 which we need to call on the object. The static typing system of Java doesn&#8217;t allow this method invocation unless the type of the object is known beforehand. This can be achieved using reflection which allows the code to scan the object and identify if it has any method called \u201cfooBar()\u201d and only then call the method if needed<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Using reflection has its own cons:<\/span><\/li>\n<\/ul>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"2\"><span style=\"font-weight: 400;\">Speed \u2014 Method invocations due to reflection are about three times slower than the direct method calls.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"2\"><span style=\"font-weight: 400;\">Type safety \u2014 When a method is invoked via its reference wrongly using reflection, invocation fails at runtime as it is not detected at compile\/load time.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"2\"><span style=\"font-weight: 400;\">Traceability \u2014 Whenever a reflective method fails, it is very difficult to find the root cause of this failure due to a huge stack trace. One has to deep dive into the invoke() and proxy() method logs to identify the root cause.<\/span><\/li>\n<\/ul>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Hence, it is advisable to follow solutions that don&#8217;t involve reflection and use this method as a last resort.<\/span><\/li>\n<\/ul>\n<h3><b>28. What are the different ways of threads usage?<\/b><\/h3>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">We can define and implement a thread in java using two ways:<\/span>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"2\"><span style=\"font-weight: 400;\">Extending the Thread class<\/span><\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Implementing the Runnable interface<\/span><\/li>\n<\/ul>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Implementing a thread using the method of Runnable interface is more preferred and advantageous as Java does not have support for multiple inheritances of classes.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">start() method is used for creating a separate call stack for the thread execution. Once the call stack is created, JVM calls the run() method for executing the thread in that call stack.<\/span><\/li>\n<\/ul>\n<h3><b>29. Diffrentiate between the constructor and method of a class in Java?<\/b><\/h3>\n<table>\n<tbody>\n<tr>\n<td><b>Constructor<\/b><\/td>\n<td><b>Method<\/b><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">Constructor is used for initializing the object state.<\/span><\/td>\n<td><span style=\"font-weight: 400;\">The method is used for exposing the object&#8217;s behaviour.<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">Constructor has no return type.<\/span><\/td>\n<td><span style=\"font-weight: 400;\">The method should have a return type. Even if it does not return anything, the return type is void.<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">Constructor gets invoked implicitly.<\/span><\/td>\n<td><span style=\"font-weight: 400;\">The method has to be invoked on the object explicitly.<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">If the constructor is not defined, then a default constructor is provided by the java compiler.<\/span><\/td>\n<td><span style=\"font-weight: 400;\">If a method is not defined, then the compiler does not provide it.<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">The constructor name should be equal to the class name.<\/span><\/td>\n<td><span style=\"font-weight: 400;\">The name of the method can have any name or have a class name too.<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">A constructor cannot be marked as final because whenever a class is inherited, the constructors are not inherited. Hence, marking it final doesn&#8217;t make sense. Java throws compilation error saying &#8211; modifier final not allowed here<\/span><\/td>\n<td><span style=\"font-weight: 400;\">A method can be defined as final but it cannot be overridden in its subclasses.<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">Final variable instantiations are possible inside a constructor and the scope of this applies to the whole class and its objects.<\/span><\/td>\n<td><span style=\"font-weight: 400;\">A final variable if initialised inside a method ensures that the variable cant is changed only within the scope of that method.<\/span><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3><b>30. Java works as a \u201cpass by value\u201d or \u201cpass by reference\u201d phenomenon?<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">Java always works as a \u201cpass by value\u201d. There is nothing called a \u201cpass by reference\u201d in Java. However, when the object is passed in any method, the address of the value is passed due to the nature of object handling in Java. When an object is passed, a copy of the reference is created by Java and that is passed to the method. The objects point to the same memory location. 2 cases might happen inside the method:<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Case 1: When the object is pointed to another location: In this case, the changes made to that object do not get reflected the original object before it was passed to the method as the reference points to another location.<\/span><\/li>\n<\/ul>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Case 2: When object references are not modified: In this case, since we have the copy of reference the main object pointing to the same memory location, any changes in the content of the object get reflected in the original object.<\/span><\/li>\n<\/ul>\n<h3><b>31. Which among String or String Buffer should be preferred when there are a lot of updates required to be done in the data?<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">StringBuffer is mutable and dynamic in nature whereas String is immutable. Every updation \/ modification of String creates a new String thereby overloading the string pool with unnecessary objects. Hence, in the cases of a lot of updates, it is always preferred to use StringBuffer as it will reduce the overhead of the creation of multiple String objects in the string pool.<\/span><\/p>\n<h3><b>32. How to not allow serialization of attributes of a class in Java?<\/b><\/h3>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">In order to achieve this, the attribute can be declared along with the usage of the transient keyword.<\/span><\/li>\n<\/ul>\n<h3><b>33. What happens if the static modifier is not included in the main method signature in Java?<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">There wouldn&#8217;t be any compilation error. But then the program is run, since the JVM cant map the main method signature, the code throws a \u201cNoSuchMethodError\u201d error at the runtime.<\/span><\/p>\n<h3><b>34. What happens if there are multiple main methods inside one class in Java?<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">The program can&#8217;t compile as the compiler says that the method has been already defined inside the class.<\/span><\/p>\n<h3><b>35. Explain Object Cloning and its usage?<\/b><\/h3>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">It is the process of creating an exact copy of any object. In order to support this, a java class has to implement the Cloneable interface of java.lang package and override the clone() method provided by the Object class.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">In case the Cloneable interface is not implemented and just the method is overridden, it results in CloneNotSupportedException in Java.<\/span><\/li>\n<\/ul>\n<h3><b>36. How does an exception propagate in the code?<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">When an exception occurs, first it searches to locate the matching catch block. In case, the matching catch block is located, then that block would be executed. Else, the exception propagates through the method call stack and goes into the caller method where the process of matching the catch block is performed. This propagation happens until the matching catch block is found. If the match is not found, then the program gets terminated in the main method.<\/span><\/p>\n<h3><b>37. Is it mandatory for a catch block to be followed after a try block?<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">No, it is not necessary for a catch block to be present after a try block. &#8211; A try block should be followed either by a catch block or by a final block. If the exceptions likelihood is more, then they should be declared using the throws clause of the method.<\/span><\/p>\n<h3><b>38. Will the finally block get executed when the return statement is written at the end of the try block and catch block as shown below?<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">finally block will be executed irrespective of the exception or not. The only case where the final block is not executed is when it encounters the \u2018System.exit()\u2019 method anywhere in the try\/catch block.<\/span><\/p>\n<h3><b>39. Can you call a constructor of a class inside another constructor?<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">Yes, the concept can be termed as constructor chaining and can be achieved using this().<\/span><\/p>\n<h3><b>40. Contiguous memory locations are usually used for storing actual values in an array but not in ArrayList. Explain.<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">In the case of ArrayList, data storing in the form of primitive data types (like int, float, etc.) is not possible. The data members\/objects present in the ArrayList have references to the objects which are located at various sites in the memory. Thus, storing actual objects or non-primitive data types (like Integer, Double, etc.) takes place in various memory locations. However, the same does not apply to the arrays. Object or primitive type values can be stored in arrays in contiguous memory locations, hence every element does not require any reference to the next element.<\/span><\/p>\n<p style=\"text-align: center;\"><a href=\"https:\/\/entri.sng.link\/Bcofz\/uu8c\/w409\" target=\"_blank\" rel=\"noopener\"><strong>Click on the link here to take video lessons for Java<\/strong><\/a><\/p>\n<p><span style=\"font-weight: 400;\">You can prepare for the entrance examinations and interviews of different types by taking into consideration our video classes and other study materials available on our platform. Entri is a learning platform that is equipped with various exports coming from backgrounds including backgrounds of Java and python programming. Enrol now and you will be eligible to get prestigious jobs in the industries of India.\u00a0<\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>If you are planning to make a career in the programming language of Java then you must also have proper specifications related to the interview and other selection procedures which is presented by the organisations in which you want to get a job. You can also take into consideration some model interviews in order to [&hellip;]<\/p>\n","protected":false},"author":72,"featured_media":25509166,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[802,1841,1882],"tags":[],"class_list":["post-25509163","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-articles","category-entri-skilling","category-java-programming"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.6 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Java Interview Questions And Answers For 2023 - Entri Blog<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/entri.app\/blog\/java-interview-questions-and-answers\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Java Interview Questions And Answers For 2023 - Entri Blog\" \/>\n<meta property=\"og:description\" content=\"If you are planning to make a career in the programming language of Java then you must also have proper specifications related to the interview and other selection procedures which is presented by the organisations in which you want to get a job. You can also take into consideration some model interviews in order to [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/entri.app\/blog\/java-interview-questions-and-answers\/\" \/>\n<meta property=\"og:site_name\" content=\"Entri Blog\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/entri.me\/\" \/>\n<meta property=\"article:published_time\" content=\"2022-02-10T06:37:34+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-01-10T09:08:23+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/entri.app\/blog\/wp-content\/uploads\/2022\/02\/Java-Interview-Questions-And-Answers-For-2022.png\" \/>\n\t<meta property=\"og:image:width\" content=\"820\" \/>\n\t<meta property=\"og:image:height\" content=\"615\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Samia Miraj\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@entri_app\" \/>\n<meta name=\"twitter:site\" content=\"@entri_app\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Samia Miraj\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"20 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/entri.app\/blog\/java-interview-questions-and-answers\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/entri.app\/blog\/java-interview-questions-and-answers\/\"},\"author\":{\"name\":\"Samia Miraj\",\"@id\":\"https:\/\/entri.app\/blog\/#\/schema\/person\/30301bca005aaf8421e047154063dabc\"},\"headline\":\"Java Interview Questions And Answers For 2023\",\"datePublished\":\"2022-02-10T06:37:34+00:00\",\"dateModified\":\"2023-01-10T09:08:23+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/entri.app\/blog\/java-interview-questions-and-answers\/\"},\"wordCount\":4112,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/entri.app\/blog\/#organization\"},\"image\":{\"@id\":\"https:\/\/entri.app\/blog\/java-interview-questions-and-answers\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/entri.app\/blog\/wp-content\/uploads\/2022\/02\/Java-Interview-Questions-And-Answers-For-2022.png\",\"articleSection\":[\"Articles\",\"Entri Skilling\",\"Java Programming\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/entri.app\/blog\/java-interview-questions-and-answers\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/entri.app\/blog\/java-interview-questions-and-answers\/\",\"url\":\"https:\/\/entri.app\/blog\/java-interview-questions-and-answers\/\",\"name\":\"Java Interview Questions And Answers For 2023 - Entri Blog\",\"isPartOf\":{\"@id\":\"https:\/\/entri.app\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/entri.app\/blog\/java-interview-questions-and-answers\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/entri.app\/blog\/java-interview-questions-and-answers\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/entri.app\/blog\/wp-content\/uploads\/2022\/02\/Java-Interview-Questions-And-Answers-For-2022.png\",\"datePublished\":\"2022-02-10T06:37:34+00:00\",\"dateModified\":\"2023-01-10T09:08:23+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/entri.app\/blog\/java-interview-questions-and-answers\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/entri.app\/blog\/java-interview-questions-and-answers\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/entri.app\/blog\/java-interview-questions-and-answers\/#primaryimage\",\"url\":\"https:\/\/entri.app\/blog\/wp-content\/uploads\/2022\/02\/Java-Interview-Questions-And-Answers-For-2022.png\",\"contentUrl\":\"https:\/\/entri.app\/blog\/wp-content\/uploads\/2022\/02\/Java-Interview-Questions-And-Answers-For-2022.png\",\"width\":820,\"height\":615,\"caption\":\"Java Interview Questions And Answers For 2022\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/entri.app\/blog\/java-interview-questions-and-answers\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/entri.app\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Entri Skilling\",\"item\":\"https:\/\/entri.app\/blog\/category\/entri-skilling\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Java Programming\",\"item\":\"https:\/\/entri.app\/blog\/category\/entri-skilling\/java-programming\/\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"Java Interview Questions And Answers For 2023\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/entri.app\/blog\/#website\",\"url\":\"https:\/\/entri.app\/blog\/\",\"name\":\"Entri Blog\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/entri.app\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/entri.app\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/entri.app\/blog\/#organization\",\"name\":\"Entri App\",\"url\":\"https:\/\/entri.app\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/entri.app\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/entri.app\/blog\/wp-content\/uploads\/2019\/10\/Entri-Logo-1.png\",\"contentUrl\":\"https:\/\/entri.app\/blog\/wp-content\/uploads\/2019\/10\/Entri-Logo-1.png\",\"width\":989,\"height\":446,\"caption\":\"Entri App\"},\"image\":{\"@id\":\"https:\/\/entri.app\/blog\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/entri.me\/\",\"https:\/\/x.com\/entri_app\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/entri.app\/blog\/#\/schema\/person\/30301bca005aaf8421e047154063dabc\",\"name\":\"Samia Miraj\",\"description\":\"Samia Miraj has been working as a news writer since 2019. Working and producing informational yet engaging content is her forte.\",\"url\":\"https:\/\/entri.app\/blog\/author\/samiamiraj33gmail-com\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Java Interview Questions And Answers For 2023 - Entri Blog","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/entri.app\/blog\/java-interview-questions-and-answers\/","og_locale":"en_US","og_type":"article","og_title":"Java Interview Questions And Answers For 2023 - Entri Blog","og_description":"If you are planning to make a career in the programming language of Java then you must also have proper specifications related to the interview and other selection procedures which is presented by the organisations in which you want to get a job. You can also take into consideration some model interviews in order to [&hellip;]","og_url":"https:\/\/entri.app\/blog\/java-interview-questions-and-answers\/","og_site_name":"Entri Blog","article_publisher":"https:\/\/www.facebook.com\/entri.me\/","article_published_time":"2022-02-10T06:37:34+00:00","article_modified_time":"2023-01-10T09:08:23+00:00","og_image":[{"width":820,"height":615,"url":"https:\/\/entri.app\/blog\/wp-content\/uploads\/2022\/02\/Java-Interview-Questions-And-Answers-For-2022.png","type":"image\/png"}],"author":"Samia Miraj","twitter_card":"summary_large_image","twitter_creator":"@entri_app","twitter_site":"@entri_app","twitter_misc":{"Written by":"Samia Miraj","Est. reading time":"20 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/entri.app\/blog\/java-interview-questions-and-answers\/#article","isPartOf":{"@id":"https:\/\/entri.app\/blog\/java-interview-questions-and-answers\/"},"author":{"name":"Samia Miraj","@id":"https:\/\/entri.app\/blog\/#\/schema\/person\/30301bca005aaf8421e047154063dabc"},"headline":"Java Interview Questions And Answers For 2023","datePublished":"2022-02-10T06:37:34+00:00","dateModified":"2023-01-10T09:08:23+00:00","mainEntityOfPage":{"@id":"https:\/\/entri.app\/blog\/java-interview-questions-and-answers\/"},"wordCount":4112,"commentCount":0,"publisher":{"@id":"https:\/\/entri.app\/blog\/#organization"},"image":{"@id":"https:\/\/entri.app\/blog\/java-interview-questions-and-answers\/#primaryimage"},"thumbnailUrl":"https:\/\/entri.app\/blog\/wp-content\/uploads\/2022\/02\/Java-Interview-Questions-And-Answers-For-2022.png","articleSection":["Articles","Entri Skilling","Java Programming"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/entri.app\/blog\/java-interview-questions-and-answers\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/entri.app\/blog\/java-interview-questions-and-answers\/","url":"https:\/\/entri.app\/blog\/java-interview-questions-and-answers\/","name":"Java Interview Questions And Answers For 2023 - Entri Blog","isPartOf":{"@id":"https:\/\/entri.app\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/entri.app\/blog\/java-interview-questions-and-answers\/#primaryimage"},"image":{"@id":"https:\/\/entri.app\/blog\/java-interview-questions-and-answers\/#primaryimage"},"thumbnailUrl":"https:\/\/entri.app\/blog\/wp-content\/uploads\/2022\/02\/Java-Interview-Questions-And-Answers-For-2022.png","datePublished":"2022-02-10T06:37:34+00:00","dateModified":"2023-01-10T09:08:23+00:00","breadcrumb":{"@id":"https:\/\/entri.app\/blog\/java-interview-questions-and-answers\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/entri.app\/blog\/java-interview-questions-and-answers\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/entri.app\/blog\/java-interview-questions-and-answers\/#primaryimage","url":"https:\/\/entri.app\/blog\/wp-content\/uploads\/2022\/02\/Java-Interview-Questions-And-Answers-For-2022.png","contentUrl":"https:\/\/entri.app\/blog\/wp-content\/uploads\/2022\/02\/Java-Interview-Questions-And-Answers-For-2022.png","width":820,"height":615,"caption":"Java Interview Questions And Answers For 2022"},{"@type":"BreadcrumbList","@id":"https:\/\/entri.app\/blog\/java-interview-questions-and-answers\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/entri.app\/blog\/"},{"@type":"ListItem","position":2,"name":"Entri Skilling","item":"https:\/\/entri.app\/blog\/category\/entri-skilling\/"},{"@type":"ListItem","position":3,"name":"Java Programming","item":"https:\/\/entri.app\/blog\/category\/entri-skilling\/java-programming\/"},{"@type":"ListItem","position":4,"name":"Java Interview Questions And Answers For 2023"}]},{"@type":"WebSite","@id":"https:\/\/entri.app\/blog\/#website","url":"https:\/\/entri.app\/blog\/","name":"Entri Blog","description":"","publisher":{"@id":"https:\/\/entri.app\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/entri.app\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/entri.app\/blog\/#organization","name":"Entri App","url":"https:\/\/entri.app\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/entri.app\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/entri.app\/blog\/wp-content\/uploads\/2019\/10\/Entri-Logo-1.png","contentUrl":"https:\/\/entri.app\/blog\/wp-content\/uploads\/2019\/10\/Entri-Logo-1.png","width":989,"height":446,"caption":"Entri App"},"image":{"@id":"https:\/\/entri.app\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/entri.me\/","https:\/\/x.com\/entri_app"]},{"@type":"Person","@id":"https:\/\/entri.app\/blog\/#\/schema\/person\/30301bca005aaf8421e047154063dabc","name":"Samia Miraj","description":"Samia Miraj has been working as a news writer since 2019. Working and producing informational yet engaging content is her forte.","url":"https:\/\/entri.app\/blog\/author\/samiamiraj33gmail-com\/"}]}},"_links":{"self":[{"href":"https:\/\/entri.app\/blog\/wp-json\/wp\/v2\/posts\/25509163","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/entri.app\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/entri.app\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/entri.app\/blog\/wp-json\/wp\/v2\/users\/72"}],"replies":[{"embeddable":true,"href":"https:\/\/entri.app\/blog\/wp-json\/wp\/v2\/comments?post=25509163"}],"version-history":[{"count":4,"href":"https:\/\/entri.app\/blog\/wp-json\/wp\/v2\/posts\/25509163\/revisions"}],"predecessor-version":[{"id":25550978,"href":"https:\/\/entri.app\/blog\/wp-json\/wp\/v2\/posts\/25509163\/revisions\/25550978"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/entri.app\/blog\/wp-json\/wp\/v2\/media\/25509166"}],"wp:attachment":[{"href":"https:\/\/entri.app\/blog\/wp-json\/wp\/v2\/media?parent=25509163"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/entri.app\/blog\/wp-json\/wp\/v2\/categories?post=25509163"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/entri.app\/blog\/wp-json\/wp\/v2\/tags?post=25509163"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}