Interview Questions and Answers - Order By Rating Q61. Is it possible to have a static class ? Core Java
Ans. We can have a static inner class but not static outer class. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Q62. Difference between List and LinkedList ? Core Java
Ans. A List is an child interface of collection interface in java where as Linked list is and implementation class of List interface which has doubly linked as a underlying data structure Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  linkedlist  list vs linkedlist Asked in 1 Companies Q63. Why packages are used 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   Q64. What is meant by platform ? Which platform does java provides ? Core Java
Ans. platform is the hardware or software environment in which a program runs. There are two types of platforms software-based and hardware-based. Java provides software-based platform. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Q65. Write an algorithm for square root of a given number. Core Java
This question was recently asked at 'IBM India'.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   Asked in 1 Companies Q66. Which is faster, LinkedList or ArrayList? Core Java
Ans. ArrayList is fast for random access, but is slow on deletion and insertion.
LinkedList is slow for random access, but is fast on deletion and insertion. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Q67. Difference between function overloading and method overloading? Core Java
This question was recently asked at 'BroadBridge'.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   Asked in 1 Companies Q68. Which interface is used for hashset implementation ? Core Java
Ans. HashSet implements Set interface. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Asked in 1 Companies Q69. why string pool concept for only String but not for StringBuffer ? Core Java
This question was recently asked at 'oodles technology'.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   Asked in 1 Companies Q70. why string pool concept for only String but not for StringBuffer ? Core Java
Ans. As String is immutable so by maintaining pool area we can refer the object to same area if they are with same content. But when it comes to string buffer or builder then due to mutable property if we do so then all the objects referring to that area will from now has new content.. So as to avoid this pool is present only in string. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Asked in 1 Companies Q71. Can you give me a use case where you utilized serialization in your project code? Core Java
Ans. we use serialization when we send response to client in JSON format.(the process of converting model object into json is nothing but serialization Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  serialization Asked in 1 Companies Q72. Write program to recursively iterate through map ? Core Java
This question was recently asked at 'Cloudflare'.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   Asked in 1 Companies Q73. Difference between interface and inheritance Core Java
This question was recently asked at 'HCL Technologies'.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   Asked in 1 Companies Q74. Combine and join integer and string list to single list and sort. Core Java
Ans. Object[] combined = new Object[first.length second.length];
System.arraycopy(first, 0, combined, 0, first.length);
System.arraycopy(second, 0, combined, first.length, second.length);
-- OR --
Object[] combined = Stream.concat(Arrays.stream(first), Arrays.stream(second)).toArray(); Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Asked in 1 Companies Q75. What are the 22 possible values of x where x== -x (true) ? Core Java
Ans. byte x = 0;
short x = 0;
char x = 0;
int x = 0;
int x = Integer.MIN_VALUE;
float x = 0.0f;
float x = -0.0f;
long x = 0;
long x = Long.MIN_VALUE;
double x = 0.0;
double x = -0.0;
Byte x = 0;
Short x = 0;
Character x = 0;
Integer x = 0;
Integer x = Integer.MIN_VALUE;
Float x = 0.0f;
Float x = -0.0f;
Long x = 0L;
Long x = Long.MIN_VALUE;
Double x = 0.0;
Double x = -0.0; Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Asked in 1 Companies Q76. Can we increase the buffer size while working with Buffered Streams ? How ? 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   Q77. Can we disable auto flushing for PrintWriter ? Core Java
Ans. Yes Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Q78. Have you ever faced any problem because of PrintWriter buffer and autoflush mechanism ? How did you got rid of it ? Core Java
Ans. Yes , we faced trouble once wherein we were trying to set certain elements to the PrintWriter. As in some cases the PrintWriter held too much information and hence it would get flushed before we could append those elements.
We disabled auto flushing and provided our own explicit flushing. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Q79. What are meta classes 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   Q80. What is something faulty about java ? Core Java
Ans. Not purely object oriented Language. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   expert Q81. Can we have more than two constructors in a class ? Core Java
Ans. Yes, through constructor overloading Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  constructor overloading Q82. If we have a return statement inside the finally block, Then what will happen ? Core Java
Ans. Returning from inside a finally block will cause exceptions to be lost. A return statement inside a finally block will cause any exception that might be thrown in the try block to be discarded. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  exception handling  finally block Asked in 1 Companies Q83. how hashmap work? Write a program that uses map interface ? Core Java
This question was recently asked at 'Huawei'.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   Asked in 1 Companies Q84. Can we have two interfaces having method with same name and arguments? Core Java
This question was recently asked at 'Boeing'.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   Asked in 1 Companies Q85. Can we load environment variables into Properties in Java ? How ? Core Java
Ans. Yes
new Properties().putAll(System.getenv()); Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  java.util.properties  environment variables Q86. Difference between System.getEnv and System.getProperties ? Core Java
Ans. System.getEnv gets the environment variables where System.getProperties gets Java properties. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  System.getEnv  System.getProperties  environment variables Q87. Difference between HashMap and Dictionary in Java ? Core Java
Ans. HashMap implements the Map interface while the Dictionary does not.
HashMap was introduced after HashTable and Dictionary.
Dictionary is currently obsolete in java. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  hashmap  dictionary class Q88. Difference between TreeMap and SortedMap ? Core Java
Ans. sortedMap is an interface ,while TreeMap is an implementation of sortMap.
We can not create an instance of sortedMap but we can create an instance of treeMap Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  treemap  sortedmap Q89. Difference between ArrayList and HashSet ? Core Java
Ans. ArrayList is a list , i.e an implementation of List interface whereas HashSet is a Set and an implementation of Set interface. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  arraylist  hashset Q90. difference between ArrayList and array ? Core Java
Ans. ArrayList is a variable length collection class whereas arrays are fixed length primitive structure.
We can use generics with arraylist but not with arrays.
We can store primitive data types within arrays but can't with ArrayList. In ArrayList that needs to be converted to Wrapper objects.
Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  arraylist  arrays  collection classes  collections basic   frequent