Interview Questions and Answers - Order By Newest Q2731. Does abstract class have public constructor? Core Java
Ans. Yes, an abstract class can have a constructor in Java. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  abstract class  public constructor Asked in 1 Companies Q2732. What measures would you take to avoid Java threading issues in a multi-threaded environment ?
This question was recently asked at 'Fifth Third Bank'.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 Ans. Yes Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  aws param store  amazon param store  aws lambda  amazon lambdaAns. No HashMap isn't synchronized. ConcurrentHashMap and Hashtable are synchronized. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  hashmap  synchronization Q2735. Is ConcurrentHashMap synchronized ? Core Java
Ans. Yes, ConcurrentHashMap is synchronized. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  ConcurrentHashMap Q2736. Difference between equals and compareTo in Java ? Core Java
Ans. "equals" is the method of object class which is supposed to be overridden to check object equality. x.equals(y) means the references x and y are holding objects that are equal.
The compareTo() method is used for comparing two objects in Java. It is usually defined for the classes whose objects needs to be ordered through Comparable interface or need to be part of an ordered collection like TreeSet or TreeMap. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  equals  compareTo  equals vs compareTo Q2737. Difference between equals and hashcode in java ? Core Java
Ans. "equals" is the method of object class which is supposed to be overridden to check object equality. x.equals(y) means the references x and y are holding objects that are equal with the equality defined by the definition of equals method.
Hashcode is used for bucketing in Hash implementations like HashMap, HashTable, HashSet etc. The value received from hashcode() is used as bucket number for storing elements. This bucket number is the address of the element inside the set/map. when you do contains() then it will take the hashcode of the element, then look for the bucket where hashcode points to and if more than 1 element is found in the same bucket (multiple objects can have the same hashcode) then it uses the equals() method to evaluate if object are equal, and then decide if contain() is true or false, or decide if element could be added in the set or not. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  equals  hascode  equals vs hascode Q2738. Difference between equals and equalsignorecase in Java ? Core Java
Ans. "equals" method is the method of object class that needs to be overridden to check object equality. This is not specific to any class like String.
equalsignorecase is the method of String class that provides a definition that ignores the case of characters during comparison.
The only difference between them in String class is that the equals() methods considers the case while equalsIgnoreCase() methods ignores the case during comparison. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  equals  equalsignorecase  equals vs equalsignorecase Q2739. Why is String a class in Java ? Core Java
Ans. 1. Creating a class helps in specifying operations on the Strings like length , sub string , concatenation etc.
2. It acts as a Wrapper class for "Array of Characters" and hence facilitates it's usage in collections, assignment to null.
3. Immutability of String objects facilitates in reuse , security and caching. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  string class Q2740. Difference between composition and aggregation 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   Q2741. 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   Q2742. 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   Q2743. 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   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   Q2745. 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 Q2746. 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   Q2747. 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   Q2748. 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 Q2749. 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 Q2750. 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 Q2751. 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 Q2752. 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 Q2753. 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 Q2754. What is xssf and hssf ?
This question was recently asked at 'Zensar'.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 Q2755. 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 Q2756. If you are asked to test an application without any documentation, What type of testing will you do ? Testing
Ans. White Box Testing
Unit Testing
Ad Hoc Testing Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Asked in 1 Companies Q2757. 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 Q2758. Sort an Employee Object based on Name or Age Database
Ans. Use Comparable or Comparator interface Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  sql query Asked in 1 Companies Q2759. What is cluster ?
This question was recently asked at 'idealake information 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 Q2760. What is the concept of hibernate versioning ? Hibernate
This question was recently asked at 'Tata Consultancy (TCS)'.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  hibernate versioning Asked in 1 Companies