W3Schools
w3schools.com โบ java โบ java_wrapper_classes.asp
Java Wrapper Classes
Java Wrapper Classes Java Generics Java Annotations Java RegEx Java Threads Java Lambda Java Advanced Sorting ... How Tos Add Two Numbers Swap Two Variables Even or Odd Number Reverse a Number Positive or Negative Square Root Area of Rectangle Celsius to Fahrenheit Sum of Digits Check Armstrong Num Random Number Count Words Count Vowels in a String Remove Vowels Count Digits in a String Reverse a String Palindrome Check Check Anagram Convert String to Array Remove Whitespace Count Character Frequency Sum of Array Elements Find Array Average Sort an Array Find Smallest Element Find Largest Element Second Largest Array Min and Max Array Merge Two Arrays Remove Duplicates Find Duplicates Shuffle an Array Factorial of a Number Fibonacci Sequence Find GCD Check Prime Number ArrayList Loop HashMap Loop Loop Through an Enum
GeeksforGeeks
geeksforgeeks.org โบ java โบ wrapper-classes-java
Wrapper Classes in Java - GeeksforGeeks
Each wrapper class encapsulates a corresponding primitive value inside an object (e.g., Integer for int, Double for double). Java provides wrapper classes for all eight primitive data types to support object-based operations.
Published ย April 6, 2026
Wrapper Classes Discussion
Read Effective Java 3rd Edition by Joshua Bloch, Item 68 for a full discussion. Joshua recommends to prefer primitives over boxed primitives. A few points he makes: *Primitives are more time and space-efficient. *Double equals operator can't be used with Boxed primitives. *Unboxing can result in a NPE. Auto-unboxing happens automatically, for example, when primitives and boxed primitives are mixed in an operation. More on reddit.com
Why use Wrapper Classes over Primitive Datatypes?
Please ensure that: Your code is properly formatted as code block - see the sidebar (About on mobile) for instructions You include any and all error messages in full You ask clear questions You demonstrate effort in solving your question/problem - plain posting your assignments is forbidden (and such posts will be removed) as is asking for or giving solutions. Trying to solve problems on your own is a very important skill. Also, see Learn to help yourself in the sidebar If any of the above points is not met, your post can and will be removed without further warning. Code is to be formatted as code block (old reddit: empty line before the code, each code line indented by 4 spaces, new reddit: https://i.imgur.com/EJ7tqek.png ) or linked via an external code hoster, like pastebin.com, github gist, github, bitbucket, gitlab, etc. Please, do not use triple backticks (```) as they will only render properly on new reddit, not on old reddit. Code blocks look like this: public class HelloWorld { public static void main(String[] args) { System.out.println("Hello World!"); } } You do not need to repost unless your post has been removed by a moderator. Just use the edit function of reddit to make sure your post complies with the above. If your post has remained in violation of these rules for a prolonged period of time (at least an hour), a moderator may remove it at their discretion. In this case, they will comment with an explanation on why it has been removed, and you will be required to resubmit the entire post following the proper procedures. To potential helpers Please, do not help if any of the above points are not met, rather report the post. We are trying to improve the quality of posts here. In helping people who can't be bothered to comply with the above points, you are doing the community a disservice. I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns. More on reddit.com
ELI 5, what is a "wrapper"
A wrapper is a class or function whose main purpose is to just forward calls to another class or function. The point of a wrapper is so you can use a different interface to access something. There are a couple big reasons to have a wrapper. One use is to simplify the interface. The functions that are part of the Windows API that operate on files, for example, require you to manually check an error code if something goes wrong. The File class wraps those functions and checks the error code for you, converting it into an exception. The Windows API functions also have a lot of optional parameters, but, since they were written in C, which doesn't have function overloading, you have to manually put in null or some default value for all of the optional arguments every time. Since C# supports overloading, the wrapper provides overloads so you don't have to specify the optional arguments. Another thing you'd use a wrapper for is if you want to access an object through an interface that the class doesn't implement. You can write a wrapper class that implements the interface and calls methods on the real object that do whatever operations. For example, Google Drive, Dropbox, and Microsoft OneDrive all have different APIs. If you're writing a program and want to be able to access files from any of them, you'd probably want to write wrappers that all implement the same interface so that you don't have to write all your file access functions three times. There's plenty of other reasons to use a wrapper, but the basic idea is that you're exposing an interface that you want to access something that has a different interface. More on reddit.com
Wrapper types in Go are cleaner than C++
I'm a big fan of this too.
If anyone wants another example, my rateio library does precisely this to provide rate-limiting mechanics for any io-implementor. There's a good example for doing it with net.Conn.
Videos
Programiz
programiz.com โบ java-programming โบ wrapper
Java Wrapper Class (With Examples)
class Main { public static void main(String[] args) { // creates objects of wrapper class Integer aObj = Integer.valueOf(23); Double bObj = Double.valueOf(5.55); // converts into primitive types int a = aObj.intValue(); double b = bObj.doubleValue(); System.out.println("The value of a: " + a); System.out.println("The value of b: " + b); } } ... In the above example, we have used the intValue() and doubleValue() method to convert the Integer and Double objects into corresponding primitive types. However, the Java compiler can automatically convert objects into corresponding primitive types.
Scaler
scaler.com โบ home โบ topics โบ java โบ wrapper classes in java
Wrapper Classes in Java - Scaler Topics
April 27, 2024 - In the Collection framework, Data Structures such as ArrayList store data only as objects, not primitive types. Wrapper classes have methods that support object creation from other object types, such as string.
Naukri
naukri.com โบ code360 โบ library โบ wrapper-class-in-java
Wrapper Class in Java with Examples and Uses
Almost there... just a few more seconds
W3Resource
w3resource.com โบ java-tutorial โบ java-wrapper-classes.php
Java Wrapper Classes - w3resource
August 19, 2022 - Each of primitive data types has dedicated class in java library. Wrapper class provides many methods while using collections like sorting, searching etc.
TechVidvan
techvidvan.com โบ tutorials โบ java-wrapper-class
Wrapper Class in Java - Learn Autoboxing & Unboxing with Coding Examples - TechVidvan
March 16, 2020 - 4. Collection Framework: The Collection Framework in Java works only with objects. All classes of the collection framework like ArrayList, LinkedList, Vector, HashSet, LinkedHashSet, TreeSet, PriorityQueue, ArrayDeque, etc, work only with objects. 5. Changing the value inside a Method: So, if we pass a primitive value using call by value, it will not change the original value. But, it will change the original value if we convert the primitive value into an object. 6. Polymorphism: Wrapper classes also help in achieving Polymorphism in Java.
Javatpoint
javatpoint.com โบ wrapper-class-in-java
Wrapper class in Java
May 29, 2014 - Wrapper class in Java with concepts and examples of Byte class, Short class, Integer class, Long class, Float class, Double class, Boolean class and Character class.
Tpoint Tech
tpointtech.com โบ wrapper-class-in-java
Wrapper Classes in Java - Tpoint Tech
3 weeks ago - Wrapper classes are predefined classes in the java.lang package that convert primitive data types into objects. They allow primitives to be used in object-oriented features such as collections and methods that require objects.
Tutorialspoint
tutorialspoint.com โบ java โบ java_wrapper_classes.htm
Java - Wrapper Classes
At the time of instantiation, these classes accept a primitive datatype directly, or in the form of String. Wrapper classes provide methods to, convert primitive datatypes within them to String objects and, to compare them with other objects etc.
Medium
medium.com โบ @priyaiotacademy122_2106 โบ java-wrapper-class-explained-key-applications-and-example-abe44d483967
Java Wrapper Class Explained โ Key Applications and Example | by priyankayadav | Medium
February 25, 2025 - In this example of class wrapper java, we create an ArrayList to store Integer objects. We demonstrate autoboxing by adding primitive int values directly to the list. When we retrieve the values, unboxing occurs automatically, converting Integer objects back to int. Additionally, we utilize the Integer.max() method to find the maximum value among the first two elements in the list, showcasing the utility of wrapper class methods.