{"id":32804,"date":"2021-06-07T13:28:00","date_gmt":"2021-06-07T07:58:00","guid":{"rendered":"https:\/\/www.mygreatlearning.com\/blog\/java-super-keyword-and-wrapper-class\/"},"modified":"2025-06-18T12:43:00","modified_gmt":"2025-06-18T07:13:00","slug":"java-super-keyword-and-wrapper-class","status":"publish","type":"post","link":"https:\/\/www.mygreatlearning.com\/blog\/java-super-keyword-and-wrapper-class\/","title":{"rendered":"Java Wrapper Classes with Examples"},"content":{"rendered":"\n<p>This guide helps you understand Java wrapper classes. You will learn their purpose, how to use them, and their benefits.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"what-are-java-wrapper-classes\">What are Java Wrapper Classes?<\/h2>\n\n\n\n<p>A Java Wrapper Class is a class in the <code>java.lang<\/code> package. It encapsulates a <a href=\"https:\/\/www.mygreatlearning.com\/blog\/data-types-in-java\/\">primitive data type<\/a> within an object. For every primitive data type, there is a corresponding wrapper class.<\/p>\n\n\n\n<p>Here is a list of primitive types and their wrapper classes:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>byte<\/code> -&gt; <code>Byte<\/code><\/li>\n\n\n\n<li><code>short<\/code> -&gt; <code>Short<\/code><\/li>\n\n\n\n<li><code>int<\/code> -&gt; <code>Integer<\/code><\/li>\n\n\n\n<li><code>long<\/code> -&gt; <code>Long<\/code><\/li>\n\n\n\n<li><code>float<\/code> -&gt; <code>Float<\/code><\/li>\n\n\n\n<li><code>double<\/code> -&gt; <code>Double<\/code><\/li>\n\n\n\n<li><code>char<\/code> -&gt; <code>Character<\/code><\/li>\n\n\n\n<li><code>boolean<\/code> -&gt; <code>Boolean<\/code><\/li>\n<\/ul>\n\n\n\n    <div class=\"courses-cta-container\">\n        <div class=\"courses-cta-card\">\n            <div class=\"courses-cta-header\">\n                <div class=\"courses-learn-icon\"><\/div>\n                <span class=\"courses-learn-text\">Academy Pro<\/span>\n            <\/div>\n            <p class=\"courses-cta-title\">\n                <a href=\"https:\/\/www.mygreatlearning.com\/academy\/premium\/master-java-programming\" class=\"courses-cta-title-link\">Java Programming Course<\/a>\n            <\/p>\n            <p class=\"courses-cta-description\">Learn Java the right way! Our course teaches you essential programming skills, from coding basics to complex projects, setting you up for success in the tech industry.<\/p>\n            <div class=\"courses-cta-stats\">\n                <div class=\"courses-stat-item\">\n                    <div class=\"courses-stat-icon courses-user-icon\"><\/div>\n                    <span>16.05 Hrs<\/span>\n                <\/div>\n                <div class=\"courses-stat-item\">\n                    <div class=\"courses-stat-icon courses-star-icon\"><\/div>\n                    <span>3 Projects<\/span>\n                <\/div>\n            <\/div>\n            <a href=\"https:\/\/www.mygreatlearning.com\/academy\/premium\/master-java-programming\" class=\"courses-cta-button\">\n                Learn Java Programming\n                <div class=\"courses-arrow-icon\"><\/div>\n            <\/a>\n        <\/div>\n    <\/div>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"why-use-wrapper-classes\">Why Use Wrapper Classes?<\/h2>\n\n\n\n<p>Wrapper classes are essential when you need to perform operations that only work with objects. Here are key reasons to use them:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><b>Collections Framework:<\/b> Java collections like <code>ArrayList<\/code> and <code><a href=\"https:\/\/www.mygreatlearning.com\/blog\/hashmap-in-java\/\">HashMap<\/a><\/code> store objects. They cannot directly store primitive types. Wrapper classes allow you to store primitive values in these collections.<\/li>\n\n\n\n<li><b>Serialization:<\/b> If you need to serialize a primitive value, you must wrap it in its corresponding wrapper class. Serialization works only with objects.<\/li>\n\n\n\n<li><b>Synchronization:<\/b> In multithreading, you can synchronize on objects. You cannot synchronize on primitive types. Wrapper objects allow you to use primitive values in synchronized blocks.<\/li>\n\n\n\n<li><b>Utility Methods:<\/b> Wrapper classes provide many useful static utility methods. These methods help convert values, parse strings, and perform other operations on primitive data. For example, <code>Integer.parseInt(\"123\")<\/code> converts a string to an integer.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"how-wrapper-classes-work\">How Wrapper Classes Work<\/h2>\n\n\n\n<p>Java provides automatic conversion between primitive types and their wrapper class objects. This feature is called autoboxing and unboxing.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"autoboxing\">Autoboxing<\/h3>\n\n\n\n<p>Autoboxing is the automatic conversion that the Java compiler makes between the primitive types and their corresponding wrapper class objects. When you assign a primitive value to a wrapper object, autoboxing occurs.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"example-of-autoboxing\">Example of Autoboxing:<\/h4>\n\n\n\n<p>Java<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\npublic class AutoboxingExample {\n    public static void main(String&#x5B;] args) {\n        int primitiveInt = 100;\n        Integer wrapperInt = primitiveInt; \/\/ Autoboxing: int to Integer\n\n        System.out.println(&quot;Wrapper Integer: &quot; + wrapperInt);\n    }\n}\n<\/pre><\/div>\n\n\n<p>In this example, the <code>int<\/code> value <code>100<\/code> is automatically converted to an <code>Integer<\/code> object.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"unboxing\">Unboxing<\/h3>\n\n\n\n<p>Unboxing is the automatic conversion that the Java compiler makes between wrapper class objects and their corresponding primitive types. When you assign a wrapper object to a primitive variable, unboxing occurs.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"example-of-unboxing\">Example of Unboxing:<\/h4>\n\n\n\n<p>Java<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\npublic class UnboxingExample {\n    public static void main(String&#x5B;] args) {\n        Integer wrapperInt = 200;\n        int primitiveInt = wrapperInt; \/\/ Unboxing: Integer to int\n\n        System.out.println(&quot;Primitive int: &quot; + primitiveInt);\n    }\n}\n<\/pre><\/div>\n\n\n<p>Here, the <code>Integer<\/code> object <code>wrapperInt<\/code> is automatically converted to an <code>int<\/code> value.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"creating-wrapper-objects\">Creating Wrapper Objects<\/h2>\n\n\n\n<p>You can create wrapper objects explicitly using their <a href=\"https:\/\/www.mygreatlearning.com\/blog\/constructor-in-java\/\">constructors<\/a> or <code>valueOf()<\/code> methods, though autoboxing often handles this for you. Using <code>valueOf()<\/code> is generally preferred for better performance, as it may cache frequently used values.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"example-of-creating-wrapper-objects\">Example of Creating Wrapper Objects:<\/h4>\n\n\n\n<p>Java<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\npublic class CreateWrapperObjects {\n    public static void main(String&#x5B;] args) {\n        \/\/ Using constructor (less common since Java 9 for some types)\n        Integer intObj1 = new Integer(10);\n        Character charObj1 = new Character(&#039;A&#039;);\n\n        \/\/ Using valueOf() method (recommended)\n        Integer intObj2 = Integer.valueOf(20);\n        Double doubleObj2 = Double.valueOf(3.14);\n\n        System.out.println(&quot;Integer object 1: &quot; + intObj1);\n        System.out.println(&quot;Character object 1: &quot; + charObj1);\n        System.out.println(&quot;Integer object 2: &quot; + intObj2);\n        System.out.println(&quot;Double object 2: &quot; + doubleObj2);\n    }\n}\n<\/pre><\/div>\n\n\n<h2 class=\"wp-block-heading\" id=\"utility-methods-in-wrapper-classes\">Utility Methods in Wrapper Classes<\/h2>\n\n\n\n<p>Wrapper classes provide many useful methods for type conversion and manipulation.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"1-parsing-strings-to-primitives\">1. Parsing Strings to Primitives:<\/h3>\n\n\n\n<p>Each numeric wrapper class has a <code>parseXxx()<\/code> static method to convert a string to its corresponding primitive type.<\/p>\n\n\n\n<p>Java<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\npublic class ParsingExample {\n    public static void main(String&#x5B;] args) {\n        String strInt = &quot;123&quot;;\n        int numInt = Integer.parseInt(strInt); \/\/ Converts &quot;123&quot; to int\n\n        String strDouble = &quot;99.5&quot;;\n        double numDouble = Double.parseDouble(strDouble); \/\/ Converts &quot;99.5&quot; to double\n\n        System.out.println(&quot;Parsed int: &quot; + numInt);\n        System.out.println(&quot;Parsed double: &quot; + numDouble);\n    }\n}\n<\/pre><\/div>\n\n\n<h3 class=\"wp-block-heading\" id=\"2-converting-primitives-to-strings\">2. Converting Primitives to Strings:<\/h3>\n\n\n\n<p>You can convert a primitive or wrapper object to a string using <code>String.valueOf()<\/code> or the <code>toString()<\/code> method of the wrapper class.<\/p>\n\n\n\n<p>Java<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\npublic class ToStringExample {\n    public static void main(String&#x5B;] args) {\n        int num = 456;\n        String strNum1 = String.valueOf(num); \/\/ int to String\n\n        Integer wrapperNum = 789;\n        String strNum2 = wrapperNum.toString(); \/\/ Integer object to String\n\n        System.out.println(&quot;String from int: &quot; + strNum1);\n        System.out.println(&quot;String from Integer object: &quot; + strNum2);\n    }\n}\n<\/pre><\/div>\n\n\n<h3 class=\"wp-block-heading\" id=\"3-comparing-wrapper-objects\">3. Comparing Wrapper Objects:<\/h3>\n\n\n\n<p>When comparing wrapper objects, use the <code>equals()<\/code> method for value comparison. Using <code>==<\/code> checks for object identity (if they refer to the exact same object in memory).<\/p>\n\n\n\n<p>Java<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\npublic class CompareWrapperObjects {\n    public static void main(String&#x5B;] args) {\n        Integer a = 10;\n        Integer b = 10;\n        Integer c = 1000;\n        Integer d = 1000;\n\n        System.out.println(&quot;a == b: &quot; + (a == b));       \/\/ True (autoboxed values -128 to 127 are cached)\n        System.out.println(&quot;a.equals(b): &quot; + a.equals(b)); \/\/ True\n\n        System.out.println(&quot;c == d: &quot; + (c == d));       \/\/ False (values outside cache range create new objects)\n        System.out.println(&quot;c.equals(d): &quot; + c.equals(d)); \/\/ True\n    }\n}\n<\/pre><\/div>\n\n\n<p>For <code>Integer<\/code> values between -128 and 127, Java caches the objects. This means <code>a == b<\/code> might return <code>true<\/code> for these values. For values outside this range, new objects are created, so <code>c == d<\/code> typically returns <code>false<\/code>. Always use <code>equals()<\/code> for value comparison.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Java Wrapper Classes provide a way to use primitive data types as objects. Java is an object-oriented language. However, it includes primitive data types like int, char, boolean, and double for performance reasons. Wrapper classes solve the need to treat these primitives as objects.<\/p>\n","protected":false},"author":41,"featured_media":32880,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"_uag_custom_page_level_css":"","site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"set","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[25860],"tags":[36826],"content_type":[],"class_list":["post-32804","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-software","tag-java"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v27.3 (Yoast SEO v27.3) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>Java Wrapper Classes with Examples<\/title>\n<meta name=\"description\" content=\"Learn about Java Wrapper Classes in this tutorial. Understand how to convert primitive types into objects, explore key methods, and see practical examples of using classes like Integer, Double, and more.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.mygreatlearning.com\/blog\/java-super-keyword-and-wrapper-class\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Java Wrapper Classes with Examples\" \/>\n<meta property=\"og:description\" content=\"Learn about Java Wrapper Classes in this tutorial. Understand how to convert primitive types into objects, explore key methods, and see practical examples of using classes like Integer, Double, and more.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.mygreatlearning.com\/blog\/java-super-keyword-and-wrapper-class\/\" \/>\n<meta property=\"og:site_name\" content=\"Great Learning Blog: Free Resources what Matters to shape your Career!\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/GreatLearningOfficial\/\" \/>\n<meta property=\"article:published_time\" content=\"2021-06-07T07:58:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-06-18T07:13:00+00:00\" \/>\n<meta property=\"og:image\" content=\"http:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2021\/05\/shutterstock_310749059.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1000\" \/>\n\t<meta property=\"og:image:height\" content=\"664\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Great Learning Editorial Team\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@https:\/\/twitter.com\/Great_Learning\" \/>\n<meta name=\"twitter:site\" content=\"@Great_Learning\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Great Learning Editorial Team\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/java-super-keyword-and-wrapper-class\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/java-super-keyword-and-wrapper-class\\\/\"},\"author\":{\"name\":\"Great Learning Editorial Team\",\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/#\\\/schema\\\/person\\\/6f993d1be4c584a335951e836f2656ad\"},\"headline\":\"Java Wrapper Classes with Examples\",\"datePublished\":\"2021-06-07T07:58:00+00:00\",\"dateModified\":\"2025-06-18T07:13:00+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/java-super-keyword-and-wrapper-class\\\/\"},\"wordCount\":503,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/java-super-keyword-and-wrapper-class\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/wp-content\\\/uploads\\\/2021\\\/05\\\/shutterstock_310749059.jpg\",\"keywords\":[\"java\"],\"articleSection\":[\"IT\\\/Software Development\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/java-super-keyword-and-wrapper-class\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/java-super-keyword-and-wrapper-class\\\/\",\"url\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/java-super-keyword-and-wrapper-class\\\/\",\"name\":\"Java Wrapper Classes with Examples\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/java-super-keyword-and-wrapper-class\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/java-super-keyword-and-wrapper-class\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/wp-content\\\/uploads\\\/2021\\\/05\\\/shutterstock_310749059.jpg\",\"datePublished\":\"2021-06-07T07:58:00+00:00\",\"dateModified\":\"2025-06-18T07:13:00+00:00\",\"description\":\"Learn about Java Wrapper Classes in this tutorial. Understand how to convert primitive types into objects, explore key methods, and see practical examples of using classes like Integer, Double, and more.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/java-super-keyword-and-wrapper-class\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/java-super-keyword-and-wrapper-class\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/java-super-keyword-and-wrapper-class\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/wp-content\\\/uploads\\\/2021\\\/05\\\/shutterstock_310749059.jpg\",\"contentUrl\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/wp-content\\\/uploads\\\/2021\\\/05\\\/shutterstock_310749059.jpg\",\"width\":1000,\"height\":664,\"caption\":\"java\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/java-super-keyword-and-wrapper-class\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Blog\",\"item\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"IT\\\/Software Development\",\"item\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/software\\\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Java Wrapper Classes with Examples\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/\",\"name\":\"Great Learning Blog\",\"description\":\"Learn, Upskill &amp; Career Development Guide and Resources\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/#organization\"},\"alternateName\":\"Great Learning\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/#organization\",\"name\":\"Great Learning\",\"url\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/06\\\/GL-Logo.jpg\",\"contentUrl\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/06\\\/GL-Logo.jpg\",\"width\":900,\"height\":900,\"caption\":\"Great Learning\"},\"image\":{\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/GreatLearningOfficial\\\/\",\"https:\\\/\\\/x.com\\\/Great_Learning\",\"https:\\\/\\\/www.instagram.com\\\/greatlearningofficial\\\/\",\"https:\\\/\\\/www.linkedin.com\\\/school\\\/great-learning\\\/\",\"https:\\\/\\\/in.pinterest.com\\\/greatlearning12\\\/\",\"https:\\\/\\\/www.youtube.com\\\/user\\\/beaconelearning\\\/\"],\"description\":\"Great Learning is a leading global ed-tech company for professional training and higher education. It offers comprehensive, industry-relevant, hands-on learning programs across various business, technology, and interdisciplinary domains driving the digital economy. These programs are developed and offered in collaboration with the world's foremost academic institutions.\",\"email\":\"info@mygreatlearning.com\",\"legalName\":\"Great Learning Education Services Pvt. Ltd\",\"foundingDate\":\"2013-11-29\",\"numberOfEmployees\":{\"@type\":\"QuantitativeValue\",\"minValue\":\"1001\",\"maxValue\":\"5000\"}},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/#\\\/schema\\\/person\\\/6f993d1be4c584a335951e836f2656ad\",\"name\":\"Great Learning Editorial Team\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/02\\\/unnamed.webp\",\"url\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/02\\\/unnamed.webp\",\"contentUrl\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/02\\\/unnamed.webp\",\"caption\":\"Great Learning Editorial Team\"},\"description\":\"The Great Learning Editorial Staff includes a dynamic team of subject matter experts, instructors, and education professionals who combine their deep industry knowledge with innovative teaching methods. Their mission is to provide learners with the skills and insights needed to excel in their careers, whether through upskilling, reskilling, or transitioning into new fields.\",\"sameAs\":[\"https:\\\/\\\/www.mygreatlearning.com\\\/\",\"https:\\\/\\\/in.linkedin.com\\\/school\\\/great-learning\\\/\",\"https:\\\/\\\/x.com\\\/https:\\\/\\\/twitter.com\\\/Great_Learning\",\"https:\\\/\\\/www.youtube.com\\\/channel\\\/UCObs0kLIrDjX2LLSybqNaEA\"],\"award\":[\"Best EdTech Company of the Year 2024\",\"Education Economictimes Outstanding Education\\\/Edtech Solution Provider of the Year 2024\",\"Leading E-learning Platform 2024\"],\"url\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/author\\\/greatlearning\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Java Wrapper Classes with Examples","description":"Learn about Java Wrapper Classes in this tutorial. Understand how to convert primitive types into objects, explore key methods, and see practical examples of using classes like Integer, Double, and more.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.mygreatlearning.com\/blog\/java-super-keyword-and-wrapper-class\/","og_locale":"en_US","og_type":"article","og_title":"Java Wrapper Classes with Examples","og_description":"Learn about Java Wrapper Classes in this tutorial. Understand how to convert primitive types into objects, explore key methods, and see practical examples of using classes like Integer, Double, and more.","og_url":"https:\/\/www.mygreatlearning.com\/blog\/java-super-keyword-and-wrapper-class\/","og_site_name":"Great Learning Blog: Free Resources what Matters to shape your Career!","article_publisher":"https:\/\/www.facebook.com\/GreatLearningOfficial\/","article_published_time":"2021-06-07T07:58:00+00:00","article_modified_time":"2025-06-18T07:13:00+00:00","og_image":[{"width":1000,"height":664,"url":"http:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2021\/05\/shutterstock_310749059.jpg","type":"image\/jpeg"}],"author":"Great Learning Editorial Team","twitter_card":"summary_large_image","twitter_creator":"@https:\/\/twitter.com\/Great_Learning","twitter_site":"@Great_Learning","twitter_misc":{"Written by":"Great Learning Editorial Team","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.mygreatlearning.com\/blog\/java-super-keyword-and-wrapper-class\/#article","isPartOf":{"@id":"https:\/\/www.mygreatlearning.com\/blog\/java-super-keyword-and-wrapper-class\/"},"author":{"name":"Great Learning Editorial Team","@id":"https:\/\/www.mygreatlearning.com\/blog\/#\/schema\/person\/6f993d1be4c584a335951e836f2656ad"},"headline":"Java Wrapper Classes with Examples","datePublished":"2021-06-07T07:58:00+00:00","dateModified":"2025-06-18T07:13:00+00:00","mainEntityOfPage":{"@id":"https:\/\/www.mygreatlearning.com\/blog\/java-super-keyword-and-wrapper-class\/"},"wordCount":503,"commentCount":0,"publisher":{"@id":"https:\/\/www.mygreatlearning.com\/blog\/#organization"},"image":{"@id":"https:\/\/www.mygreatlearning.com\/blog\/java-super-keyword-and-wrapper-class\/#primaryimage"},"thumbnailUrl":"https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2021\/05\/shutterstock_310749059.jpg","keywords":["java"],"articleSection":["IT\/Software Development"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.mygreatlearning.com\/blog\/java-super-keyword-and-wrapper-class\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.mygreatlearning.com\/blog\/java-super-keyword-and-wrapper-class\/","url":"https:\/\/www.mygreatlearning.com\/blog\/java-super-keyword-and-wrapper-class\/","name":"Java Wrapper Classes with Examples","isPartOf":{"@id":"https:\/\/www.mygreatlearning.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.mygreatlearning.com\/blog\/java-super-keyword-and-wrapper-class\/#primaryimage"},"image":{"@id":"https:\/\/www.mygreatlearning.com\/blog\/java-super-keyword-and-wrapper-class\/#primaryimage"},"thumbnailUrl":"https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2021\/05\/shutterstock_310749059.jpg","datePublished":"2021-06-07T07:58:00+00:00","dateModified":"2025-06-18T07:13:00+00:00","description":"Learn about Java Wrapper Classes in this tutorial. Understand how to convert primitive types into objects, explore key methods, and see practical examples of using classes like Integer, Double, and more.","breadcrumb":{"@id":"https:\/\/www.mygreatlearning.com\/blog\/java-super-keyword-and-wrapper-class\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.mygreatlearning.com\/blog\/java-super-keyword-and-wrapper-class\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.mygreatlearning.com\/blog\/java-super-keyword-and-wrapper-class\/#primaryimage","url":"https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2021\/05\/shutterstock_310749059.jpg","contentUrl":"https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2021\/05\/shutterstock_310749059.jpg","width":1000,"height":664,"caption":"java"},{"@type":"BreadcrumbList","@id":"https:\/\/www.mygreatlearning.com\/blog\/java-super-keyword-and-wrapper-class\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Blog","item":"https:\/\/www.mygreatlearning.com\/blog\/"},{"@type":"ListItem","position":2,"name":"IT\/Software Development","item":"https:\/\/www.mygreatlearning.com\/blog\/software\/"},{"@type":"ListItem","position":3,"name":"Java Wrapper Classes with Examples"}]},{"@type":"WebSite","@id":"https:\/\/www.mygreatlearning.com\/blog\/#website","url":"https:\/\/www.mygreatlearning.com\/blog\/","name":"Great Learning Blog","description":"Learn, Upskill &amp; Career Development Guide and Resources","publisher":{"@id":"https:\/\/www.mygreatlearning.com\/blog\/#organization"},"alternateName":"Great Learning","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.mygreatlearning.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.mygreatlearning.com\/blog\/#organization","name":"Great Learning","url":"https:\/\/www.mygreatlearning.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.mygreatlearning.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2022\/06\/GL-Logo.jpg","contentUrl":"https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2022\/06\/GL-Logo.jpg","width":900,"height":900,"caption":"Great Learning"},"image":{"@id":"https:\/\/www.mygreatlearning.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/GreatLearningOfficial\/","https:\/\/x.com\/Great_Learning","https:\/\/www.instagram.com\/greatlearningofficial\/","https:\/\/www.linkedin.com\/school\/great-learning\/","https:\/\/in.pinterest.com\/greatlearning12\/","https:\/\/www.youtube.com\/user\/beaconelearning\/"],"description":"Great Learning is a leading global ed-tech company for professional training and higher education. It offers comprehensive, industry-relevant, hands-on learning programs across various business, technology, and interdisciplinary domains driving the digital economy. These programs are developed and offered in collaboration with the world's foremost academic institutions.","email":"info@mygreatlearning.com","legalName":"Great Learning Education Services Pvt. Ltd","foundingDate":"2013-11-29","numberOfEmployees":{"@type":"QuantitativeValue","minValue":"1001","maxValue":"5000"}},{"@type":"Person","@id":"https:\/\/www.mygreatlearning.com\/blog\/#\/schema\/person\/6f993d1be4c584a335951e836f2656ad","name":"Great Learning Editorial Team","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2022\/02\/unnamed.webp","url":"https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2022\/02\/unnamed.webp","contentUrl":"https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2022\/02\/unnamed.webp","caption":"Great Learning Editorial Team"},"description":"The Great Learning Editorial Staff includes a dynamic team of subject matter experts, instructors, and education professionals who combine their deep industry knowledge with innovative teaching methods. Their mission is to provide learners with the skills and insights needed to excel in their careers, whether through upskilling, reskilling, or transitioning into new fields.","sameAs":["https:\/\/www.mygreatlearning.com\/","https:\/\/in.linkedin.com\/school\/great-learning\/","https:\/\/x.com\/https:\/\/twitter.com\/Great_Learning","https:\/\/www.youtube.com\/channel\/UCObs0kLIrDjX2LLSybqNaEA"],"award":["Best EdTech Company of the Year 2024","Education Economictimes Outstanding Education\/Edtech Solution Provider of the Year 2024","Leading E-learning Platform 2024"],"url":"https:\/\/www.mygreatlearning.com\/blog\/author\/greatlearning\/"}]}},"uagb_featured_image_src":{"full":["https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2021\/05\/shutterstock_310749059.jpg",1000,664,false],"thumbnail":["https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2021\/05\/shutterstock_310749059-150x150.jpg",150,150,true],"medium":["https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2021\/05\/shutterstock_310749059-300x199.jpg",300,199,true],"medium_large":["https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2021\/05\/shutterstock_310749059-768x510.jpg",768,510,true],"large":["https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2021\/05\/shutterstock_310749059.jpg",1000,664,false],"1536x1536":["https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2021\/05\/shutterstock_310749059.jpg",1000,664,false],"2048x2048":["https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2021\/05\/shutterstock_310749059.jpg",1000,664,false],"web-stories-poster-portrait":["https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2021\/05\/shutterstock_310749059-640x664.jpg",640,664,true],"web-stories-publisher-logo":["https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2021\/05\/shutterstock_310749059-96x96.jpg",96,96,true],"web-stories-thumbnail":["https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2021\/05\/shutterstock_310749059-150x100.jpg",150,100,true]},"uagb_author_info":{"display_name":"Great Learning Editorial Team","author_link":"https:\/\/www.mygreatlearning.com\/blog\/author\/greatlearning\/"},"uagb_comment_info":0,"uagb_excerpt":"Java Wrapper Classes provide a way to use primitive data types as objects. Java is an object-oriented language. However, it includes primitive data types like int, char, boolean, and double for performance reasons. Wrapper classes solve the need to treat these primitives as objects.","_links":{"self":[{"href":"https:\/\/www.mygreatlearning.com\/blog\/wp-json\/wp\/v2\/posts\/32804","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.mygreatlearning.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.mygreatlearning.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.mygreatlearning.com\/blog\/wp-json\/wp\/v2\/users\/41"}],"replies":[{"embeddable":true,"href":"https:\/\/www.mygreatlearning.com\/blog\/wp-json\/wp\/v2\/comments?post=32804"}],"version-history":[{"count":14,"href":"https:\/\/www.mygreatlearning.com\/blog\/wp-json\/wp\/v2\/posts\/32804\/revisions"}],"predecessor-version":[{"id":108654,"href":"https:\/\/www.mygreatlearning.com\/blog\/wp-json\/wp\/v2\/posts\/32804\/revisions\/108654"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.mygreatlearning.com\/blog\/wp-json\/wp\/v2\/media\/32880"}],"wp:attachment":[{"href":"https:\/\/www.mygreatlearning.com\/blog\/wp-json\/wp\/v2\/media?parent=32804"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.mygreatlearning.com\/blog\/wp-json\/wp\/v2\/categories?post=32804"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.mygreatlearning.com\/blog\/wp-json\/wp\/v2\/tags?post=32804"},{"taxonomy":"content_type","embeddable":true,"href":"https:\/\/www.mygreatlearning.com\/blog\/wp-json\/wp\/v2\/content_type?post=32804"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}