Interview Questions and Answers for 'Java' | Search Java Interview Question - javasearch.buggybread.com
Javasearch.buggybread.com
Share

Search Interview Questions


 3152 questions in repository.
 There are more than 200 unanswered questions.
Click here and help us by providing the answer.
 Have a video suggestion.
Click Correct / Improve and please let us know.
Label / Company      Label / Company / Text

   



Interview Questions and Answers for 'Java' - 1649 question(s) found - Order By Rating

next 40
 Q1. Can we load environment variables into Properties in Java ? How ?Core Java2019-02-06 13:43:28

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


 Q2. Difference between System.getEnv and System.getProperties ?Core Java2019-02-06 13:34:58

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


 Q3. Difference between HashMap and Dictionary in Java ?Core Java2019-02-06 11:26:39

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


 Q4. Difference between ArrayList and HashSet ?Core Java2019-02-06 11:24:19

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


 Q5. difference between ArrayList and array ?Core Java2019-02-06 11:23:55

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


 Q6. Why is String a class in Java ?Core Java2019-02-06 11:14:14

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


 Q7. Difference between equals and equalsignorecase in Java ?Core Java2019-02-05 16:44:09

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


 Q8. Difference between equals and hashcode in java ?Core Java2019-02-05 16:40:21

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


 Q9. Difference between equals and compareTo in Java ?Core Java2019-02-05 16:38:11

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



Do you think these are the Best Java Frameworks ?

OpenXavaSPRING MVCApache StripesCheck everything
that is Best in Java

Click Here



 Q10. Is ConcurrentHashMap synchronized ?Core Java2019-02-05 10:40:27

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


 Q11. Is HashMap Synchronized ?Core Java2019-02-05 10:39:32

Ans. 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


 Q12. Does abstract class have public constructor? Core Java2019-02-02 17:27:21

 This question was recently asked at 'Tavant 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     abstract class  public constructor     Tavant Technology


 Q13. Explain CloneNotSupportedException ?Core Java2019-02-02 17:26:10

 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     exceptions handling  cloning


 Q14. What does 'variable hoisting' mean? JavaScript2019-02-02 15:27:12

Ans.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like      Discuss      Correct / Improve          Mad Mobile


 Q15. How many heaps will be there with 3 threads ?Core Java2019-02-02 15:24:13

 This question was recently asked at 'General Atomics'.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     memory management  heap memory     General Atomics


 Q16. How to write an iterator for an iterator of iterators?Core Java2019-02-01 12:33:36

 This question was recently asked at 'Delphix'.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     iterator     Delphix


 Q17. Can we have a final argument in a method ? What is the use of that if we do so ?Core Java2019-01-31 20:34:58

 This question was recently asked at 'Webster 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          Webster Bank


 Q18. why is "".equals(str); safer than str.equals("")?Core Java2019-01-31 20:34:18

 This question was recently asked at 'Glory Global Solutions'.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     equals method     Glory Global Solutions


 Q19. Write a method that would solve two problems at the same time ?Core Java2019-01-31 20:33:17

Ans. We can return value for one problem solving or computation and set the value for other in some member element.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like      Discuss      Correct / Improve     



Do you think these are the Best Java Frameworks ?

OpenXavaSPRING MVCApache StripesCheck everything
that is Best in Java

Click Here



 Q20. Can a constructor be declared static ? Why ?Core Java2019-01-30 16:39:27

Ans. No.

When we declare a method static, it means that "this belongs to class as whole and not particular instance". The whole purpose of constructor is to initialize a object and hence there is no sense having static constructor.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like      Discuss      Correct / Improve     constructor  static  static constructor     HCL Technologies


 Q21. Can constructors be final ?Core Java2019-01-30 16:37:12

Ans. No. They are never inherited and therefore are not subject to hiding or overriding.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like      Discuss      Correct / Improve     constructor  final  final constructor     HCL Technologies


 Q22. Have you ever worked on continuations in Java ?Core Java2019-01-29 13:23:50

 This question was recently asked at 'Overstock.com'.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          Overstock.com


 Q23. What is the use of this keyword in javascript ?Javascript2019-01-27 16:09:03

 This question was recently asked at '23AndMe'.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          23AndMe


 Q24. What are inline functions ? Do we have inline functions in Java ?Core Java2019-01-25 07:42:38

Ans. Inline functions , just like C++ Macros is an optimized technique used by compiler to reduce the execution time. If the function is working on pre identified values ( which aren't resolved at runtime ), the function can execute the method and evaluate the outcome at compile time only instead of making a function call at runtime.

In Java, the optimizations are usually done at the runtime or JVM level. At runtime, the JVM perform some analysis to determine which methods to inline. Java compiler would never inline any method and there is no way in java for the developer to explicitly define inlining of methods as it's take intrinsically care of during runtime only.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like      Discuss      Correct / Improve     inline functions  inline methods


 Q25. What is the default size of list ? How it is growable ?Core Java2019-01-23 11:22:47

 This question was recently asked at 'Citius Tech'.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     list  default size of list     Citius Tech


 Q26. Can a method return more than one value at a time in Java ?Core Java2019-01-22 14:32:38

Ans. object / native type returned can only be one but an object can comprise of a array , collection or a group of different value types.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like      Discuss      Correct / Improve     java methods


 Q27. Difference between Base Class, Derived Class , Abstract Class and Concrete Class ?Core Java2019-01-20 10:09:38

Ans. Base Class is a relative term used to signify the Parent class in Parent - Child or Base - derived relationship.

Derived Class is a relative term used to signify the Child class in Parent - Child or Base - derived relationship.

Abstract Class is a class that is not allowed to be instantiated and hence can serve only a base class for it's usage.

Concrete Class is the class which is supposed to be instantiated and hence provide definition for all implementing interface methods and extending abstract methods.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like      Discuss      Correct / Improve     Base Class   Derived Class    Abstract Class   Concrete Class


 Q28. Can an abstract class be a derived class ?Core Java2019-01-20 10:06:18

Ans. Yes, an abstract class can extend another class.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like      Discuss      Correct / Improve     abstract class


 Q29. What is the relationship between Base Class and Abstract Class ?Core Java2019-01-20 10:04:28

Ans. Abstract Class is a class that's only allowed to be a Base class for it's usage. It can never be instantiated on it's own.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like      Discuss      Correct / Improve     base class  abstract class      basic



Do you think these are the Best Java Frameworks ?

OpenXavaSPRING MVCApache StripesCheck everything
that is Best in Java

Click Here



 Q30. What is a base class ? Is Abstract class and Base class the same thing ?Core Java2019-01-20 10:01:12

Ans. Base Class is a relative term. For example - Class Vehicle is a Base class of Class Car. Even though Base class is derived in this case , there is no restriction on instantiation of Vehicle class.

Abstract Class is a class that is meant only to be a Base Class and not allowed to be instantiated.

Abstract Class is a Base Class that isn't allowed to be instantiated and is only meant for carrying definition to derived class and help participate in runtime polymorphism.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like      Discuss      Correct / Improve          Infosys


 Q31. What are the biggest challenges for Java technology in the coming years?Core Java2019-01-19 11:03:31

Ans. JVM - With Cloud and Serverless, this could be a hurdle for it to be preferred technology.

Confusion between OOP and Functional Programming.

Slower speed of innovation due to wider adoption.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like      Discuss      Correct / Improve     


 Q32. Explain difference between web-based application and Core Java Application ?Java2019-01-17 22:47:18
Aly Chiman
aly1@alychidesigns.com
 This question was recently asked at 'Tripod'.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          Tripod


 Q33. Difference between List and ArrayList ?Core Java2019-01-17 20:28:50

Ans. List is an interface whereas ArrayList is an implementation of List.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like      Discuss      Correct / Improve     list  arraylist  list vs arraylist  difference between  collections     Selam Albania  HCL Technologies      basic


 Q34. If you override hashcode to always return true, how a hash based collection will behave?Core Java2019-01-16 12:42:56

 This question was recently asked at 'Synechron'.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     hashcode  collections     Synechron


 Q35. Difference between String constant and String non-constant pools?Core Java2019-01-10 13:22:56

 This question was recently asked at 'VMWare'.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          VMWare


 Q36. Difference between "extend" and "implement" in java?Core Java2019-01-10 13:22:35

 This question was recently asked at 'VM Ware'.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          VM Ware


 Q37. Can we serialize objects with only private variables in Java ?Core Java2019-01-10 09:41:01

Ans. It depends on how we are serializing. The Serialization API doesn't worry about private variables and convert it into binary representation.

If we are using a library to map it to JSON / XML using XML Mappers, it may create trouble.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like      Discuss      Correct / Improve     serialization


 Q38. What is input Stream ?Core Java2018-12-12 15:38:47

 This question was recently asked at 'SQUAD Infotech'.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     stream  inout output  inour stream     SQUAD Infotech


 Q39. What will happen if there are no collections in java ?Core Java2018-12-11 16:19:37

Ans. Collections in Java is nothing but a library implementation for data structures and algorithm. If it's not available , we might have to include some other library or provide our own implementation.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like      Discuss      Correct / Improve     collections



Do you think these are the Best Java Frameworks ?

OpenXavaSPRING MVCApache StripesCheck everything
that is Best in Java

Click Here



 Q40. What will happen if there are no enums in Java ?Core Java2018-12-11 16:18:29

Ans. Enums in Java is a facility to have objects upfront and use them as constants. Even if such a facility is not available , a workaround could be achieved.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like      Discuss      Correct / Improve     enum


next 40


Subscribe to Java News and Posts. Get latest updates and posts on Java from Buggybread.com
Enter your email address:
Delivered by FeedBurner



comments powered by Disqus
 

Help us and Others Improve. Please let us know the questions asked in any of your previous interview.

Any input from you will be highly appreciated and It will unlock the application for 10 more requests.

Company Name:
Questions Asked:
         

X Close this

X Close this

Help Us Improve.
Please share your
interview experience.

Company Name:   


Questions Asked: