The document discusses autoboxing and unboxing in Java. Autoboxing converts primitive data types like int to their wrapper class equivalents like Integer. Unboxing performs the reverse conversion from wrapper classes to primitives. This allows primitive values to be added to collections which only accept objects. While this improves code readability and flexibility, it can reduce performance due to memory overhead and increased garbage collection. Examples of both autoboxing and unboxing are provided but not described in detail.
Mobile Software Engineering Crash Course - C02 Java PrimerMohammad Shaker
This document provides an introduction to the Java programming language. It discusses Java concepts like object-oriented programming, the Java Virtual Machine, primitive data types, variables, control flow, classes and objects, inheritance, interfaces, exceptions, collections, multithreading, design patterns, and more. It also includes code examples and references to Oracle's Java documentation for further reading.
C++ Object oriented concepts & programmingnirajmandaliya
This document discusses various C++ concepts related to functions and operators. It defines what a default pointer is and how it receives addresses passed to a called function. It also discusses reference variables, inline functions, friend functions, default arguments, passing objects as parameters, function overloading, static members, function pointers, and operator overloading. It provides examples and explanations for each concept.
This document discusses various C++ concepts related to functions including:
- Default pointers which receive addresses passed to called functions.
- Reference variables which receive the reference of an actual variable passed to a function. Changing the reference variable directly changes the actual variable.
- Inline functions which eliminate context switching when defined inside a class or declared with the inline keyword.
- Friend functions which have access to private/protected members of a class they are declared as a friend to.
OCA Java SE 8 Exam Chapter 1 Java Building Blocksİbrahim Kürce
The document discusses key concepts in Java including classes, objects, fields, methods, variables, primitive types, reference types, and memory management. It explains that classes are the basic building blocks in Java programs and contain fields and methods. Objects are instances of classes that exist in memory. The document also covers variable scope, default initialization, and garbage collection in Java.
JavaScript language plays a very important role in Web 2.0 application development. JavaScript has its own characteristics different than object-oriented languages and it's not easy for developers to understand.
This presentation covers major advanced topics in JavaScript languages, including prototype chain, identifier resolving, "this" keyword, "new" operator, execution context and scope chain and closure. Besides that, it also covers best practices when using JavaScript.
The document discusses autoboxing and unboxing in Java. Autoboxing converts primitive data types like int to their wrapper class equivalents like Integer. Unboxing performs the reverse conversion from wrapper classes to primitives. This allows primitive values to be added to collections which only accept objects. While this improves code readability and flexibility, it can reduce performance due to memory overhead and increased garbage collection. Examples of both autoboxing and unboxing are provided but not described in detail.
Mobile Software Engineering Crash Course - C02 Java PrimerMohammad Shaker
This document provides an introduction to the Java programming language. It discusses Java concepts like object-oriented programming, the Java Virtual Machine, primitive data types, variables, control flow, classes and objects, inheritance, interfaces, exceptions, collections, multithreading, design patterns, and more. It also includes code examples and references to Oracle's Java documentation for further reading.
C++ Object oriented concepts & programmingnirajmandaliya
This document discusses various C++ concepts related to functions and operators. It defines what a default pointer is and how it receives addresses passed to a called function. It also discusses reference variables, inline functions, friend functions, default arguments, passing objects as parameters, function overloading, static members, function pointers, and operator overloading. It provides examples and explanations for each concept.
This document discusses various C++ concepts related to functions including:
- Default pointers which receive addresses passed to called functions.
- Reference variables which receive the reference of an actual variable passed to a function. Changing the reference variable directly changes the actual variable.
- Inline functions which eliminate context switching when defined inside a class or declared with the inline keyword.
- Friend functions which have access to private/protected members of a class they are declared as a friend to.
OCA Java SE 8 Exam Chapter 1 Java Building Blocksİbrahim Kürce
The document discusses key concepts in Java including classes, objects, fields, methods, variables, primitive types, reference types, and memory management. It explains that classes are the basic building blocks in Java programs and contain fields and methods. Objects are instances of classes that exist in memory. The document also covers variable scope, default initialization, and garbage collection in Java.
JavaScript language plays a very important role in Web 2.0 application development. JavaScript has its own characteristics different than object-oriented languages and it's not easy for developers to understand.
This presentation covers major advanced topics in JavaScript languages, including prototype chain, identifier resolving, "this" keyword, "new" operator, execution context and scope chain and closure. Besides that, it also covers best practices when using JavaScript.
Encapsulation isolates the internal complexity of an object's operation from the rest of the application. Inheritance allows one class to reuse the state and behavior of another class. Polymorphism allows a client to treat different objects in the same way even if they were created from different classes and exhibit different behaviors.
This document discusses the syllabus for the course IT1301 - Object Oriented Programming. It covers key concepts in OOP like classes, objects, inheritance, polymorphism, abstraction and encapsulation. It also discusses features of Java like being platform independent, secure, robust etc. The document contains examples and questions related to OOP concepts in Java. Constructors and their types, access specifiers, object class and reflection are explained in detail with examples. Creation and accessing of user-defined packages in Java is also discussed.
C/C++ Programming interview questions and answers document discusses key concepts in C++ including encapsulation, inheritance, polymorphism, constructors, destructors, copy constructors, references, virtual functions, abstract classes, and memory alignment. The document provides definitions and examples to explain each concept.
This document discusses object-oriented programming concepts. It defines an object as anything that can be represented by data and manipulated by a program. An object has properties that hold its data values and methods that manipulate the properties. A class is a blueprint that defines the properties and methods for instances of objects. The document provides examples of physical and non-physical objects and how they are represented by properties and methods in object-oriented programming.
Wrapper classes allow primitive data types like int and double to be used as objects. Each primitive type has a corresponding wrapper class like Integer and Double. Wrapper classes allow primitive values to be passed by reference rather than by value. GUIs can be created using Swing components like JFrame for windows and JOptionPane for simple input/output dialogs. Components are added to the content pane of the JFrame to build the GUI interface.
The document discusses Java strings and string comparison. It provides details on Java string class methods like charAt(), length(), substring(), contains(), equals(), etc. It also discusses the three ways to compare strings in Java: 1) Using the equals() method which compares string content, 2) Using the == operator which compares references, and 3) Using the compareTo() method which compares strings lexicographically. Examples of comparing strings using the equals() method are also provided.
This document discusses classes and objects in Java. It explains that classes are composite data types that can contain variables of different primitive data types. A class acts as a blueprint for creating objects. The new keyword is used to instantiate objects from classes. Wrapper classes are also discussed, which allow primitive data types like int and double to be used as objects. Specific methods of the Integer wrapper class are provided as examples.
This document discusses classes and objects in Java. It explains that classes are composite data types that can contain variables of different primitive data types. Wrapper classes are described as classes that wrap primitive data types in objects. The Integer wrapper class is discussed in detail, including how to instantiate Integer objects, common methods like parseInt() and toString(), and examples of converting between Strings and int primitives.
This document provides an overview of a JavaScript training presentation. It discusses:
- The presenter and their background in software development and TV apps.
- What topics will be covered, including JavaScript principles, vanilla JS, becoming JS ninjas, and specific concepts like prototypes, types, scope, and patterns.
- Benefits of learning JavaScript like it being the language of the web and used for both frontend and backend development.
- Interesting facts about the history and creation of JavaScript.
- Primitive types like strings, numbers, booleans being similar to pizza ingredients, and object types being able to contain other values.
- Syntax for objects, properties, methods, and the prototype
The document discusses various storage classes in C and C++. It describes the auto, register, static, extern and mutable storage classes. It explains how each storage class affects a variable's storage duration, scope and linkage. It provides examples to illustrate the usage and behaviors of variables declared with different storage classes.
This document discusses Java wrapper classes. It introduces wrapper classes as classes that "objectify" the primitive Java types, with each primitive type having a corresponding wrapper class (e.g. Integer for int). It describes using wrapper classes for collection elements, creating wrapper objects from values using valueOf(), getting the primitive value from a wrapper object, parsing strings to primitive values, and MAX_VALUE constants in the number wrappers. Examples are provided for converting between Integer, Float, Byte, Long, Short, and string objects.
This document provides an overview of object-oriented programming concepts including abstraction, encapsulation, classes, objects, methods, constructors, inheritance, polymorphism, and interfaces. It explains that classes act as blueprints for objects, describing their data and behaviors. Objects are instances of classes that have state stored in attributes and behaviors defined by methods. Key features of OOP like inheritance, encapsulation, and polymorphism are discussed at a high level.
This document provides an overview of advanced JavaScript concepts beyond jQuery, including traversing the DOM, element objects, functions, native objects, closures, manipulating data with array methods, prototypal inheritance, revealing modules, and function composition. It discusses using vanilla JavaScript instead of jQuery for DOM manipulation and events. It also explains JavaScript functions, closures, and how functions are first-class citizens that can be assigned to variables and passed as arguments. The document outlines prototypal inheritance in JavaScript and alternative patterns like factories and composition. It provides examples for working with arrays, closures, and building reusable objects.
Wrapper classes allow primitives to be used as objects by encapsulating primitive values within objects. For each primitive type (e.g. int, double), there is a corresponding wrapper class (e.g. Integer, Double). Wrapper classes can be created using the new operator or static valueOf() methods. They allow primitives to be added to collections and returned from methods as objects. Autoboxing further automates the wrapping of primitives into objects.
This document discusses Javascript objects. It defines what objects are, how they are created using object literals, the Object constructor, and function constructors. It explains that objects are reference types and compares setting properties using dot notation vs bracket notation. The document also covers the Object.defineProperty method and its uses of enumerable, writable, and configurable properties. It aims to prove that almost everything in Javascript is an object, providing examples of native objects. The document discusses the 'this' keyword and how its value is determined by how a function is called rather than its definition. It compares direct invocation, invoking as an object method, and using call, apply and bind to set the context.
The document discusses storage classes in C++. It explains that every variable has a storage class and scope. The storage class determines where storage is allocated and how long it exists, while scope specifies visibility. It describes the auto, register, static, and extern storage classes. Auto variables are allocated and destroyed on block entry/exit, register suggests register storage, static retains value between function calls, and extern extends scope to other files. It provides examples of each storage class and their differences between C and C++.
This document discusses autoboxing and unboxing in Java. It explains that autoboxing allows primitive data types to be automatically wrapped into their corresponding wrapper classes when used where an object is expected. Unboxing is the reverse process where the primitive value is automatically extracted from the wrapper class. This simplifies coding by eliminating the need to manually wrap and unwrap values. Autoboxing and unboxing was introduced in Java 5 to make programming with primitive types and wrapper classes more convenient.
introduction, The Resolution of Property Names on Objects.
Closure
A "closure" is an expression (typically a function) that can have
free variables together with an environment that binds those
variables (that "closes" the expression)
This document discusses container classes in object-oriented programming. It examines tensions between strong typing and reuse in statically typed languages. Three approaches are presented to address this issue: using substitution and downcasting, substitution and overriding, and generics. Iterators and visitors are also discussed as solutions for traversing container elements without exposing internal structures.
The document provides an overview of JavaScript programming. It discusses the history and components of JavaScript, including ECMAScript, the DOM, and BOM. It also covers JavaScript basics like syntax, data types, operators, and functions. Finally, it introduces object-oriented concepts in JavaScript like prototype-based programming and early vs. late binding.
Walmart Business+ and Spark Good for Nonprofits.pdfTechSoup
"Learn about all the ways Walmart supports nonprofit organizations.
You will hear from Liz Willett, the Head of Nonprofits, and hear about what Walmart is doing to help nonprofits, including Walmart Business and Spark Good. Walmart Business+ is a new offer for nonprofits that offers discounts and also streamlines nonprofits order and expense tracking, saving time and money.
The webinar may also give some examples on how nonprofits can best leverage Walmart Business+.
The event will cover the following::
Walmart Business + (https://business.walmart.com/plus) is a new shopping experience for nonprofits, schools, and local business customers that connects an exclusive online shopping experience to stores. Benefits include free delivery and shipping, a 'Spend Analytics” feature, special discounts, deals and tax-exempt shopping.
Special TechSoup offer for a free 180 days membership, and up to $150 in discounts on eligible orders.
Spark Good (walmart.com/sparkgood) is a charitable platform that enables nonprofits to receive donations directly from customers and associates.
Answers about how you can do more with Walmart!"
More Related Content
Similar to Package ppt basics of package in Java program
Encapsulation isolates the internal complexity of an object's operation from the rest of the application. Inheritance allows one class to reuse the state and behavior of another class. Polymorphism allows a client to treat different objects in the same way even if they were created from different classes and exhibit different behaviors.
This document discusses the syllabus for the course IT1301 - Object Oriented Programming. It covers key concepts in OOP like classes, objects, inheritance, polymorphism, abstraction and encapsulation. It also discusses features of Java like being platform independent, secure, robust etc. The document contains examples and questions related to OOP concepts in Java. Constructors and their types, access specifiers, object class and reflection are explained in detail with examples. Creation and accessing of user-defined packages in Java is also discussed.
C/C++ Programming interview questions and answers document discusses key concepts in C++ including encapsulation, inheritance, polymorphism, constructors, destructors, copy constructors, references, virtual functions, abstract classes, and memory alignment. The document provides definitions and examples to explain each concept.
This document discusses object-oriented programming concepts. It defines an object as anything that can be represented by data and manipulated by a program. An object has properties that hold its data values and methods that manipulate the properties. A class is a blueprint that defines the properties and methods for instances of objects. The document provides examples of physical and non-physical objects and how they are represented by properties and methods in object-oriented programming.
Wrapper classes allow primitive data types like int and double to be used as objects. Each primitive type has a corresponding wrapper class like Integer and Double. Wrapper classes allow primitive values to be passed by reference rather than by value. GUIs can be created using Swing components like JFrame for windows and JOptionPane for simple input/output dialogs. Components are added to the content pane of the JFrame to build the GUI interface.
The document discusses Java strings and string comparison. It provides details on Java string class methods like charAt(), length(), substring(), contains(), equals(), etc. It also discusses the three ways to compare strings in Java: 1) Using the equals() method which compares string content, 2) Using the == operator which compares references, and 3) Using the compareTo() method which compares strings lexicographically. Examples of comparing strings using the equals() method are also provided.
This document discusses classes and objects in Java. It explains that classes are composite data types that can contain variables of different primitive data types. A class acts as a blueprint for creating objects. The new keyword is used to instantiate objects from classes. Wrapper classes are also discussed, which allow primitive data types like int and double to be used as objects. Specific methods of the Integer wrapper class are provided as examples.
This document discusses classes and objects in Java. It explains that classes are composite data types that can contain variables of different primitive data types. Wrapper classes are described as classes that wrap primitive data types in objects. The Integer wrapper class is discussed in detail, including how to instantiate Integer objects, common methods like parseInt() and toString(), and examples of converting between Strings and int primitives.
This document provides an overview of a JavaScript training presentation. It discusses:
- The presenter and their background in software development and TV apps.
- What topics will be covered, including JavaScript principles, vanilla JS, becoming JS ninjas, and specific concepts like prototypes, types, scope, and patterns.
- Benefits of learning JavaScript like it being the language of the web and used for both frontend and backend development.
- Interesting facts about the history and creation of JavaScript.
- Primitive types like strings, numbers, booleans being similar to pizza ingredients, and object types being able to contain other values.
- Syntax for objects, properties, methods, and the prototype
The document discusses various storage classes in C and C++. It describes the auto, register, static, extern and mutable storage classes. It explains how each storage class affects a variable's storage duration, scope and linkage. It provides examples to illustrate the usage and behaviors of variables declared with different storage classes.
This document discusses Java wrapper classes. It introduces wrapper classes as classes that "objectify" the primitive Java types, with each primitive type having a corresponding wrapper class (e.g. Integer for int). It describes using wrapper classes for collection elements, creating wrapper objects from values using valueOf(), getting the primitive value from a wrapper object, parsing strings to primitive values, and MAX_VALUE constants in the number wrappers. Examples are provided for converting between Integer, Float, Byte, Long, Short, and string objects.
This document provides an overview of object-oriented programming concepts including abstraction, encapsulation, classes, objects, methods, constructors, inheritance, polymorphism, and interfaces. It explains that classes act as blueprints for objects, describing their data and behaviors. Objects are instances of classes that have state stored in attributes and behaviors defined by methods. Key features of OOP like inheritance, encapsulation, and polymorphism are discussed at a high level.
This document provides an overview of advanced JavaScript concepts beyond jQuery, including traversing the DOM, element objects, functions, native objects, closures, manipulating data with array methods, prototypal inheritance, revealing modules, and function composition. It discusses using vanilla JavaScript instead of jQuery for DOM manipulation and events. It also explains JavaScript functions, closures, and how functions are first-class citizens that can be assigned to variables and passed as arguments. The document outlines prototypal inheritance in JavaScript and alternative patterns like factories and composition. It provides examples for working with arrays, closures, and building reusable objects.
Wrapper classes allow primitives to be used as objects by encapsulating primitive values within objects. For each primitive type (e.g. int, double), there is a corresponding wrapper class (e.g. Integer, Double). Wrapper classes can be created using the new operator or static valueOf() methods. They allow primitives to be added to collections and returned from methods as objects. Autoboxing further automates the wrapping of primitives into objects.
This document discusses Javascript objects. It defines what objects are, how they are created using object literals, the Object constructor, and function constructors. It explains that objects are reference types and compares setting properties using dot notation vs bracket notation. The document also covers the Object.defineProperty method and its uses of enumerable, writable, and configurable properties. It aims to prove that almost everything in Javascript is an object, providing examples of native objects. The document discusses the 'this' keyword and how its value is determined by how a function is called rather than its definition. It compares direct invocation, invoking as an object method, and using call, apply and bind to set the context.
The document discusses storage classes in C++. It explains that every variable has a storage class and scope. The storage class determines where storage is allocated and how long it exists, while scope specifies visibility. It describes the auto, register, static, and extern storage classes. Auto variables are allocated and destroyed on block entry/exit, register suggests register storage, static retains value between function calls, and extern extends scope to other files. It provides examples of each storage class and their differences between C and C++.
This document discusses autoboxing and unboxing in Java. It explains that autoboxing allows primitive data types to be automatically wrapped into their corresponding wrapper classes when used where an object is expected. Unboxing is the reverse process where the primitive value is automatically extracted from the wrapper class. This simplifies coding by eliminating the need to manually wrap and unwrap values. Autoboxing and unboxing was introduced in Java 5 to make programming with primitive types and wrapper classes more convenient.
introduction, The Resolution of Property Names on Objects.
Closure
A "closure" is an expression (typically a function) that can have
free variables together with an environment that binds those
variables (that "closes" the expression)
This document discusses container classes in object-oriented programming. It examines tensions between strong typing and reuse in statically typed languages. Three approaches are presented to address this issue: using substitution and downcasting, substitution and overriding, and generics. Iterators and visitors are also discussed as solutions for traversing container elements without exposing internal structures.
The document provides an overview of JavaScript programming. It discusses the history and components of JavaScript, including ECMAScript, the DOM, and BOM. It also covers JavaScript basics like syntax, data types, operators, and functions. Finally, it introduces object-oriented concepts in JavaScript like prototype-based programming and early vs. late binding.
Similar to Package ppt basics of package in Java program (20)
Walmart Business+ and Spark Good for Nonprofits.pdfTechSoup
"Learn about all the ways Walmart supports nonprofit organizations.
You will hear from Liz Willett, the Head of Nonprofits, and hear about what Walmart is doing to help nonprofits, including Walmart Business and Spark Good. Walmart Business+ is a new offer for nonprofits that offers discounts and also streamlines nonprofits order and expense tracking, saving time and money.
The webinar may also give some examples on how nonprofits can best leverage Walmart Business+.
The event will cover the following::
Walmart Business + (https://business.walmart.com/plus) is a new shopping experience for nonprofits, schools, and local business customers that connects an exclusive online shopping experience to stores. Benefits include free delivery and shipping, a 'Spend Analytics” feature, special discounts, deals and tax-exempt shopping.
Special TechSoup offer for a free 180 days membership, and up to $150 in discounts on eligible orders.
Spark Good (walmart.com/sparkgood) is a charitable platform that enables nonprofits to receive donations directly from customers and associates.
Answers about how you can do more with Walmart!"
বাংলাদেশের অর্থনৈতিক সমীক্ষা ২০২৪ [Bangladesh Economic Review 2024 Bangla.pdf] কম্পিউটার , ট্যাব ও স্মার্ট ফোন ভার্সন সহ সম্পূর্ণ বাংলা ই-বুক বা pdf বই " সুচিপত্র ...বুকমার্ক মেনু 🔖 ও হাইপার লিংক মেনু 📝👆 যুক্ত ..
আমাদের সবার জন্য খুব খুব গুরুত্বপূর্ণ একটি বই ..বিসিএস, ব্যাংক, ইউনিভার্সিটি ভর্তি ও যে কোন প্রতিযোগিতা মূলক পরীক্ষার জন্য এর খুব ইম্পরট্যান্ট একটি বিষয় ...তাছাড়া বাংলাদেশের সাম্প্রতিক যে কোন ডাটা বা তথ্য এই বইতে পাবেন ...
তাই একজন নাগরিক হিসাবে এই তথ্য গুলো আপনার জানা প্রয়োজন ...।
বিসিএস ও ব্যাংক এর লিখিত পরীক্ষা ...+এছাড়া মাধ্যমিক ও উচ্চমাধ্যমিকের স্টুডেন্টদের জন্য অনেক কাজে আসবে ...
it describes the bony anatomy including the femoral head , acetabulum, labrum . also discusses the capsule , ligaments . muscle that act on the hip joint and the range of motion are outlined. factors affecting hip joint stability and weight transmission through the joint are summarized.
A review of the growth of the Israel Genealogy Research Association Database Collection for the last 12 months. Our collection is now passed the 3 million mark and still growing. See which archives have contributed the most. See the different types of records we have, and which years have had records added. You can also see what we have for the future.
How to Manage Your Lost Opportunities in Odoo 17 CRMCeline George
Odoo 17 CRM allows us to track why we lose sales opportunities with "Lost Reasons." This helps analyze our sales process and identify areas for improvement. Here's how to configure lost reasons in Odoo 17 CRM
Main Java[All of the Base Concepts}.docxadhitya5119
This is part 1 of my Java Learning Journey. This Contains Custom methods, classes, constructors, packages, multithreading , try- catch block, finally block and more.
हिंदी वर्णमाला पीपीटी, hindi alphabet PPT presentation, hindi varnamala PPT, Hindi Varnamala pdf, हिंदी स्वर, हिंदी व्यंजन, sikhiye hindi varnmala, dr. mulla adam ali, hindi language and literature, hindi alphabet with drawing, hindi alphabet pdf, hindi varnamala for childrens, hindi language, hindi varnamala practice for kids, https://www.drmullaadamali.com
The simplified electron and muon model, Oscillating Spacetime: The Foundation...RitikBhardwaj56
Discover the Simplified Electron and Muon Model: A New Wave-Based Approach to Understanding Particles delves into a groundbreaking theory that presents electrons and muons as rotating soliton waves within oscillating spacetime. Geared towards students, researchers, and science buffs, this book breaks down complex ideas into simple explanations. It covers topics such as electron waves, temporal dynamics, and the implications of this model on particle physics. With clear illustrations and easy-to-follow explanations, readers will gain a new outlook on the universe's fundamental nature.
The simplified electron and muon model, Oscillating Spacetime: The Foundation...
Package ppt basics of package in Java program
1.
2. Wrapper classes in Java
The wrapper class in Java provides the mechanism to convert primitive data types into object and object into primitive data types. Each of Java's eight primitive data
types has a class dedicated to it. These are known as wrapper classes, because they "wrap" the primitive data type into an object of that class. The wrapper classes
are part of the java.lang package, which is imported by default into all Java programs. Since J2SE 5.0, autoboxing and unboxing feature convert primitives into
objects and objects into primitives automatically. The automatic conversion of primitive into an object is known as autoboxing and vice-versa unboxing.
Primitive Type Wrapper class
boolean Boolean
char Character
byte Byte
short Short
Int a Integer
long Long
float Float
3. Autoboxing :
The automatic conversion of primitive data type into its corresponding wrapper
class is known as autoboxing, for example, byte to Byte, char to Character, int to
Integer, long to Long, float to Float, boolean to Boolean, double to Double, and
short to Short.
4. Example: Primitive to Wrapper
//Java program to convert primitive into objects
//Autoboxing example of int to Integer
class Auto
{
public static void main(String args[])
{
int a=20;
Integer i=Integer.valueOf(a); //Converting int into Integer
//converting int into Integer explicitly
Integer j=a; //autoboxing, now compiler will write Integer.valueOf(a) internally
System.out.println(a+" "+i+" "+j);
}
}
Output:
20 20 20
5. Unboxing :
The automatic conversion of wrapper type into its corresponding primitive type is
known as unboxing. It is the reverse process of autoboxing.
6. Example: Wrapper to Primitive
//Java program to convert object into primitives
//Unboxing example of Integer to int
class Ex
{
public static void main(String args[])
{
Integer a=new Integer(8); //Converting Integer to int
int i=a.intValue(); //converting Integer to int explicitly
int j=a; //unboxing, now compiler will write a.intValue() internally
System.out.println(a+" "+i+" "+j);
}
}
Output:
8 8 8
7. A. Conversion function (data type to object type) using .valueOf() function
Example :
class Main {
public static void main(String[] args) {
int x = 20;
String str = "22";
System.out.println(String.valueOf(x) + str);
}}
O/P : 2022