Interview Questions and Answers - Order By Newest Q1051. How is the virtual method table implemented in Java? Core Java
This question is still unanswered. Can you please provide an answer. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  virtual method table   method overriding  runtime polymorphism  object oriented programming (oops)  oops concepts expert   rare Q1052. How many VTables are there for each class ? Core Java
Ans. There is one VTable for each class. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  virtual table method  vtable  runtime polymorphism  object oriented programming (oops)  oops concepts   method overriding intermediate   rare Q1053. Have you ever used java.util.Objects class ? Core Java
Ans. Yes, We are using requireNonNull method for validating if the object is null. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  objects  util methods   rare Q1054. Why do we use getbytes in Java? Core Java
Ans. It is used to convert String into an array of bytes.
byte[] getBytes() - converts String into a byte array.
byte[] getBytes(Charset charset) - converts String to byte array, based on charset encoding. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Q1055. Can Java be run on hardware with just the JVM and no OS ? Core Java
This question is still unanswered. Can you please provide an answer. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Q1056. Which java feature is used to convert primitive type to reference type ? Core Java
Ans. AutoBoxing Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Q1057. What is a reflexive equals contract ? Core Java
Ans. An equal contract is said to be reflexive is equality between 2 objects always returns to be true.
For example -
Object o1;
Object o2;
o1.equals(o2); // returns true
o2.equals(o1); //returns true Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  reflexive equals contract Q1058. Explain Transitive equals contract. Core Java
Ans. The equals contract is said to be transitive if
obj1.equals(obj2); and obj2(.equals(obj3)
then obj1.equals(obj3) also returns true. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  Transitive equals contract   rare Q1059. How will you enable or disable assertion for a package during runtime ? Core Java
This question is still unanswered. Can you please provide an answer. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Q1060. Which java version supports assertion ? Core Java
This question is still unanswered. Can you please provide an answer. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Q1061. Create an event class in Java. Core Java
This question is still unanswered. Can you please provide an answer. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  event class Q1062. How does multi threading improve performance ? Core Java
Ans. Every process in it's timeline require different resources. Utilization of resources can be optimized when they are shared among different processes or threads. When one thread is sleeping waiting for a peripheral to complete (e.g. a disk write, or a key press from the keyboard), other threads can continue using processor time and hence would lead to better usage of resources. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  multithreading  threads basic   frequent Q1063. What are the different ways to avoid multi Threading related problems in Java ? Core Java
Ans. Synchronization,
Concurrent classes,
Volatile keyword,
Implementing concurrent Lock interface,
Immutable classes Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  multithreading  threads  ways to avoid thread related problems  synchronization  volatile  concurrent collections Intermediate Q1064. What is context switching wrt Threads in Java? Core Java
Ans. Context Switching is the process of storing and restoring of CPU state so that Thread execution can be resumed from the same point at a later point of time. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  Threads  multithreading  context switching Q1065. What is Lock interface in Java Concurrency API ? Core Java
Ans. Lock interface provide more extensive locking. They allow more flexible structuring and may support multiple associated Condition objects. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  concurrency api Q1066. Why Concurrent Collection Classes are fail-fast in Java ? Core Java
This question is still unanswered. Can you please provide an answer. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  concurrent collection classes   fail fast   fail-fast  collections  collection classes expert Q1067. Can a class extend itself in Java ? Core Java
Ans. No Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  inheritance  object oriented programming (oops)  oops concepts Q1068. What is method hiding in Java ? Core Java
This question is still unanswered. Can you please provide an answer. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  method hiding Q1069. Can you prevent overriding a method without using final modifier or without declaring it private ? Core Java
This question is still unanswered. Can you please provide an answer. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Q1070. Can we override a non-static method as static in Java ? Core Java
Ans. No, there is no method overriding with static methods. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Q1071. Can we declare constructor inside an interface ? Why ? Core Java
This question is still unanswered. Can you please provide an answer. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  interface   constructor Q1072. Can we declare an Interface with abstract keyword ? Core Java
Ans. Yes Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  abstract keyword Q1073. Does Java generate .class file for interfaces ? Core Java
Ans. Yes Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  .class file  java byte code  interfaces This question is still unanswered. Can you please provide an answer. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  arrays Q1075. Can we change the size of array once created ? Core Java
Ans. No. Arrays cannot resize dynamically. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  array  array size Basic Q1076. Can we use generics with arrays in Java ? Core Java
Ans. No Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Q1077. What is the difference between ArrayIndexOutOfBoundException and ArrayStoreException? Core Java
This question is still unanswered. Can you please provide an answer. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  exception handling Q1078. What is ArrayStoreException ? Core Java
Ans. It's an exception that is thrown when we attempt to add value of an incompatible type to an array.
For example -
Object[] strArray = new String[2];
strArray[0] = 5;
In this code, strArray reference of type Object has currently been assigned the String array but at line 2 we are trying to add an integer value. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  arrays   ArrayStoreException Q1079. What is an anonymous array in Java ? Core Java
This question is still unanswered. Can you please provide an answer. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  anonymous arraysAns. an array of different sizes Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  arrays  jagged arrays