Interview Questions and Answers - Order By Newest Q1551. Does garbage collection affects performance of the application ? 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   Q1552. Does garbage collection happens in String pool ? 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   Q1553. Does garbage collection call dispose ? 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   Q1554. What is the difference between final and static in java ? Core Java
Ans. final keyword is used to restrict the user from modifying the variable, extending the class and overriding a method
static keyword is used for memory management which can be used for variable, class, method where in it belongs to the class not to the instance of object Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Asked in 2 Companies Q1555. How can we run a java program through command line ? 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   Q1556. Difference between ArrayList and Vector ? Core Java
Ans. Vector is Synchronized one where as Arraylist is not Synchronized. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Q1557. 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 Q1558. 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 Q1559. 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 Q1560. 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 Q1561. 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 Q1562. 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 Q1563. 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 Q1564. 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 Q1565. 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 Q1566. 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 Q1567. 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 Q1568. 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   Q1569. How do you debug Javascript code ? Javascript
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   Q1570. 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   Q1571. 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   Q1572. 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   Q1573. 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 Q1574. 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 Q1575. 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 Q1576. 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 Q1577. 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 Q1578. 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 Q1579. 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 Q1580. 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