Interview Questions and Answers - Order By Newest Q1181. 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 Q1182. 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 Q1183. 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 Q1184. 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 Q1185. 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 Q1186. 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 Q1187. 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 Q1188. 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 Q1189. 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   Q1190. 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   Q1191. 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   Q1192. 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   Q1193. 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 Q1194. 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 Q1195. 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 Q1196. 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 Q1197. 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 Q1198. 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 Q1199. 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 Q1200. 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   Q1201. 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 Q1202. 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   Q1203. 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   Q1204. 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   Q1205. Why in Java does it require "static" in the main function? Core Java
Ans. Because there needs to be a starting point till when there is no object created in memory and hence it needs to be run in static scope Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Asked in 1 Companies Q1206. What are the different types of inheritance ? Core Java
Ans. Single Level
Multi Level
Hierarchical
Multiple
Hybrid Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Asked in 1 Companies Q1207. Is there a way to access a private method from an outside class ? Core Java
Ans. Through Reflection. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Asked in 1 Companies Q1208. Difference between class and object with example. Core Java
This question was recently asked at 'TalenPace'.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 Q1209. What if we use all access specifiers ? Is it encapsulation ? Core Java
This question was recently asked at '3 Embeded Software 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 Q1210. Explain how a class is loaded ? Core Java
Ans. Java classLoder is resposible to load java classes. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Asked in 1 Companies