logo

CuriousTab

CuriousTab

Discussion


Home Interview Technology Comments

  • Question
  • Why do we need wrapper classes in Java?


  • Correct Answer
  • Dealing with primitives as objects is easier at times Most of the objects collection store objects and not primitive types Many utility methods are provided by wrapper classes To get these advantages we need to use wrapper classes As they are objects, they can be stored in any of the collection and pass this collection as parameters to the methods Features of the Java wrapper Classes: - Wrapper classes convert numeric strings into numeric values - The way to store primitive data in an object - The valueOf() method is available in all wrapper classes except Character - All wrapper classes have typeValue() method This method returns the value of the object as its primitive type 


  • Technology problems


    Search Results


    • 1. How does thread synchronization occurs inside a monitor?
    • Discuss
    • 2. What is Auto boxing and unboxing?
    • Discuss
    • 3. What are Native methods in Java?
    • Discuss
    • 4. What is the SimpleTimeZone class?
    • Discuss
    • 5. What is the Set interface ?
    • Discuss
    • 6. What is Shallow and deep cloning in Java?
    • Discuss
    • 7. What is the similarity between Dynamic Binding and linking?
    • Discuss
    • 8. What is dynamic method dispatch?
    • Discuss
    • 9. What are pass by reference and pass by value ?
    • Discuss
    • 10. Explain different ways of creating a thread. Which one would you prefer and why ?
    • Discuss


    Comments

    There are no comments.

Enter a new Comment