SlideShare a Scribd company logo
1 of 15
Project Report
Java Programing
Topic
Wrapper Class and
Nesting Methods
Submitted by:
Akshay Sharma
BCA IInd YEAR
Dezyne E’cole College
www.dezyneecole.com
INFORMATION TECHNOLOGY
P a g e 1 | 14
Project Report
On
Java Programing
At
Dezyne E’cole College
Ajmer
Submitted to
Dezyne E’cole College
Towards The
Practical Fulfillment on
BCA
By
Akshay Sharma
Dezyne E’cole College
106/10, Civil-lines, Ajmer
Tel: 0145-2624679
www.dezyneecole.com
Year
P a g e 2 | 14
2016-2017
ACKNOWLEDGEMENT
I Akshay Sharma, Student Of Dezyne E’cole College, Am Extremely Who Has
Grateful To Each And Every Individual Who Has Contributed In Successful
Completion Of My Project. I Express My Gratitude Towards Dezyne E’cole College
For Their Guidance And Constant Supervision As Well As For Providing The
Necessary Information And Support Regarding The Completion
Thank You
P a g e 3 | 14
SYNOPSIS
This Project Is A Miner. Project Made, Based On The Theoretical Concepts Of
JAVA. This Project Has Made Our Basic Concepts On Java Strong.
P a g e 4 | 14
Wrapper classes
As pointed out earlier, vectors cannot handle primitive data types like int, float, char, and double.
Primitive data type may be converted into object types by using the wrapper classes contained in
the java.lang Package. Following table shows the simple data types and their corresponding
wrapper class types.
Wrapper Classes for Converting Types
Simply Type Wrapper class
boolean Boolean
char Character
double Double
float Float
Int Integer
long Long
The wrapper classes have a number of unique methods for handling primitive data type of objects.
They are listed in the following tables.
Converting Primitive Numbers to Objects Number Using Constructor Method
Constructor Calling Conversion Action
Integer IntVal=new Integer(i); Primitive integer to Integer Object
Float FloatVal=new Float(f); Primitive float to Float Object
Double DoubleVal=new Double(d); Primitive double to Double Object
Long LongVal=new Long(l); primitive long to Long Object
Converting Objects Numbers to Primitive Number Using typeValue () Method
Method Calling Conversion Action
int i=IntVal.intValue(); Object to Primitive integer
float f=FloatVal.floatValue(); Object to Primitive float
long l=LongVal.lingValue(); Object to Primitive long
double d=DoubleVal.doubleValue(); Object to Primitive double
P a g e 5 | 14
Converting Numbers to String Using to String () Method
Method Calling Conversion Action
str=Integer.toString(i); Primitive integer to string
str=Float.toFloat(f); Primitive float to string
str=Double.toDouble(d); primitive double to string
str=Long.toLong(); primitive long to string
Converting String Objects to Numbers Objects Using the Static Method value Of ()
Method Calling Conversion Action
DoubleVal=Double.valueOf(str) Converts string to Double Object
FloatVal=Float.valueOf(str) Converts string to Float Object
IntVal=Integer.valueOf(str) Converts string to Integer Object
LongVal=Long.valueOf(str) Converts string to Long Object
Converting Numeric String to Primitive Numbers Using Parsing Methods
Method Calling Conversion Action
Int i=Integer.parseInt(str) Converts string to primitive integer
Float f=Float.parseFloat(str) Converts string to primitive Float
long l=Long.praseLong(str) Converts string to primitive Long
Double d=Double.praseDouble(str) Converts string to primitive Double
Converting Numeric String to Primitive Numbers Using Parsing Methods
Method Calling Conversion Action
int i=Integer.parseInt(str); Converts string to primitive Integer
long l=Long.parseInt(str); Converts string to primitive long
P a g e 6 | 14
Converting Primitive Numbers to Object Numbers
Output:-
P a g e 7 | 14
Converting Object Numbers to Primitive Numbers
Output:-
P a g e 8 | 14
Converting Number to String
Output:-
P a g e 9 | 14
Converting String Object to Numeric Object
Output:-
P a g e 10 | 14
Converting Numeric String to primitive Number
Output:-
P a g e 11 | 14
AutoBoxing and UnBoxing
The auto boxing and unboxing feature, introduced in J2SE 5.0, facilitates the process for
handling primitive data types in collections. We can use this feature to convert primitive data types
to wrapper class types automatically. The compiler generates a code implicitly to convert primitive
type to the corresponding wrapper class type and vice-versa.
For example:-
Consider the following statements:-
Double d=98.42;
Double dbl=d.doubleValue ();
Using the auto boxing and unboxing feature we can rewrite the above code as:-
Double d=98.42;
Double dbl=d;
How, the java compiler provides restriction to perform the following conversions:
 Converts from Null type to any primitive type.
 Converts to the Null type 0ther than the identify conversion.
 Converts from any class type c to any array type if c is not object.
P a g e 12 | 14
Vector without using auto boxing and unboxing
Output:-
P a g e 13 | 14
Vector with using auto boxing and unboxing
Output:-
P a g e 14 | 14
THANK YOU

More Related Content

What's hot

What's hot (20)

Ronak Kachhawa,BCA 2nd Year
Ronak Kachhawa,BCA 2nd YearRonak Kachhawa,BCA 2nd Year
Ronak Kachhawa,BCA 2nd Year
 
Bhanu Pratap Singh ,BCA
Bhanu Pratap Singh ,BCA Bhanu Pratap Singh ,BCA
Bhanu Pratap Singh ,BCA
 
Rounit Mathur,BCA 2nd year.
Rounit Mathur,BCA 2nd year.Rounit Mathur,BCA 2nd year.
Rounit Mathur,BCA 2nd year.
 
Pooja Sharma ,BCA 2nd Year
Pooja Sharma ,BCA 2nd YearPooja Sharma ,BCA 2nd Year
Pooja Sharma ,BCA 2nd Year
 
Kajal Gaharwal,BCA 2nd Year
Kajal Gaharwal,BCA 2nd YearKajal Gaharwal,BCA 2nd Year
Kajal Gaharwal,BCA 2nd Year
 
Rakesh Bijawat, BCA 2nd Year
Rakesh Bijawat, BCA 2nd YearRakesh Bijawat, BCA 2nd Year
Rakesh Bijawat, BCA 2nd Year
 
Rakesh Bijawat , BCA Third Year
Rakesh Bijawat , BCA Third YearRakesh Bijawat , BCA Third Year
Rakesh Bijawat , BCA Third Year
 
Varun Kaushik, BCA 2nd Year
Varun Kaushik, BCA 2nd YearVarun Kaushik, BCA 2nd Year
Varun Kaushik, BCA 2nd Year
 
Farhaan Ahmed, BCA 2nd Year
Farhaan Ahmed, BCA 2nd YearFarhaan Ahmed, BCA 2nd Year
Farhaan Ahmed, BCA 2nd Year
 
Deepika Mittal,BCA ,2nd Year
Deepika Mittal,BCA ,2nd Year Deepika Mittal,BCA ,2nd Year
Deepika Mittal,BCA ,2nd Year
 
Ravi Sharma,BCA 2nd Year
Ravi Sharma,BCA 2nd YearRavi Sharma,BCA 2nd Year
Ravi Sharma,BCA 2nd Year
 
Nikita Totlani ,BCA 2nd year
Nikita Totlani ,BCA 2nd year Nikita Totlani ,BCA 2nd year
Nikita Totlani ,BCA 2nd year
 
Ram Prasad ,BCA 2nd Year
Ram Prasad ,BCA 2nd YearRam Prasad ,BCA 2nd Year
Ram Prasad ,BCA 2nd Year
 
Daksh Sharma ,BCA 2nd Year
Daksh  Sharma ,BCA 2nd YearDaksh  Sharma ,BCA 2nd Year
Daksh Sharma ,BCA 2nd Year
 
Kaushal Soni,BCA,2nd Year
Kaushal Soni,BCA,2nd YearKaushal Soni,BCA,2nd Year
Kaushal Soni,BCA,2nd Year
 
Karishma Dhanwani,BCA 2nd Year
Karishma Dhanwani,BCA 2nd YearKarishma Dhanwani,BCA 2nd Year
Karishma Dhanwani,BCA 2nd Year
 
Shivani Chouhan ,BCA ,2nd Year
Shivani Chouhan ,BCA ,2nd YearShivani Chouhan ,BCA ,2nd Year
Shivani Chouhan ,BCA ,2nd Year
 
Mithlesh Singh Rawat, BCA 2nd Year
Mithlesh Singh Rawat, BCA 2nd Year Mithlesh Singh Rawat, BCA 2nd Year
Mithlesh Singh Rawat, BCA 2nd Year
 
Yashika Soni, BCA 2nd Year
Yashika Soni, BCA 2nd YearYashika Soni, BCA 2nd Year
Yashika Soni, BCA 2nd Year
 
Amit Kumar Yadav ,BCA
Amit Kumar Yadav ,BCAAmit Kumar Yadav ,BCA
Amit Kumar Yadav ,BCA
 

Similar to Akshay Sharma,BCA,2nd year

Similar to Akshay Sharma,BCA,2nd year (11)

BCA 2nd year Java prog. File
BCA 2nd year Java prog. FileBCA 2nd year Java prog. File
BCA 2nd year Java prog. File
 
Wrapper classes
Wrapper classesWrapper classes
Wrapper classes
 
Brijesh Peswani,BCA 2nd Year
Brijesh Peswani,BCA 2nd YearBrijesh Peswani,BCA 2nd Year
Brijesh Peswani,BCA 2nd Year
 
Sudarshan Joshi,BCA 2nd Year
Sudarshan Joshi,BCA 2nd Year Sudarshan Joshi,BCA 2nd Year
Sudarshan Joshi,BCA 2nd Year
 
Shaikh Mohammad Usman Haider ,BCA 2nd Year
Shaikh Mohammad Usman Haider ,BCA 2nd Year Shaikh Mohammad Usman Haider ,BCA 2nd Year
Shaikh Mohammad Usman Haider ,BCA 2nd Year
 
Kirti Kumawat
Kirti KumawatKirti Kumawat
Kirti Kumawat
 
Pooja Sharma , BCA Third Year
Pooja Sharma , BCA Third YearPooja Sharma , BCA Third Year
Pooja Sharma , BCA Third Year
 
Ravi Prakash,BCA,2nd Year
Ravi Prakash,BCA,2nd YearRavi Prakash,BCA,2nd Year
Ravi Prakash,BCA,2nd Year
 
Compose Camp - Intro.pdf.pdf
Compose Camp - Intro.pdf.pdfCompose Camp - Intro.pdf.pdf
Compose Camp - Intro.pdf.pdf
 
Kajal Gaharwal , BCA Third Year
Kajal Gaharwal , BCA Third YearKajal Gaharwal , BCA Third Year
Kajal Gaharwal , BCA Third Year
 
Presentation on design pattern software project lll
 Presentation on design pattern  software project lll  Presentation on design pattern  software project lll
Presentation on design pattern software project lll
 

More from dezyneecole

More from dezyneecole (20)

Gracika Benjamin , Diploma Fashion Design Second Year
Gracika Benjamin , Diploma Fashion Design Second YearGracika Benjamin , Diploma Fashion Design Second Year
Gracika Benjamin , Diploma Fashion Design Second Year
 
Sheikh Anjum Firdoush , Diploma Fashion Design Second Year
Sheikh Anjum Firdoush , Diploma Fashion Design Second YearSheikh Anjum Firdoush , Diploma Fashion Design Second Year
Sheikh Anjum Firdoush , Diploma Fashion Design Second Year
 
Harsha Chhaparwal, Diploma Fashion Design Second Year
Harsha Chhaparwal, Diploma Fashion Design Second YearHarsha Chhaparwal, Diploma Fashion Design Second Year
Harsha Chhaparwal, Diploma Fashion Design Second Year
 
Harsha Chhaparwal, Diploma Fashion Design Second Year
Harsha Chhaparwal, Diploma Fashion Design Second YearHarsha Chhaparwal, Diploma Fashion Design Second Year
Harsha Chhaparwal, Diploma Fashion Design Second Year
 
Harsha Chhaparwal, Diploma Fashion Design Second Year
Harsha Chhaparwal, Diploma Fashion Design Second YearHarsha Chhaparwal, Diploma Fashion Design Second Year
Harsha Chhaparwal, Diploma Fashion Design Second Year
 
Sheikh Anjum Firdoush , Diploma Fashion Design Second Year
Sheikh Anjum Firdoush , Diploma Fashion Design Second YearSheikh Anjum Firdoush , Diploma Fashion Design Second Year
Sheikh Anjum Firdoush , Diploma Fashion Design Second Year
 
Sushmita Bhati, Diploma Fashion Design Second Year
Sushmita Bhati, Diploma Fashion Design Second YearSushmita Bhati, Diploma Fashion Design Second Year
Sushmita Bhati, Diploma Fashion Design Second Year
 
Sushmita Bhati, Diploma Fashion Design Second Year
Sushmita Bhati, Diploma Fashion Design Second YearSushmita Bhati, Diploma Fashion Design Second Year
Sushmita Bhati, Diploma Fashion Design Second Year
 
Sushmita Bhati, Diploma Fashion Design Second Year, (How to Design for Fashio...
Sushmita Bhati, Diploma Fashion Design Second Year, (How to Design for Fashio...Sushmita Bhati, Diploma Fashion Design Second Year, (How to Design for Fashio...
Sushmita Bhati, Diploma Fashion Design Second Year, (How to Design for Fashio...
 
Somya Jain, Diploma Fashion Design Second Year, (How to Design for Fashion In...
Somya Jain, Diploma Fashion Design Second Year, (How to Design for Fashion In...Somya Jain, Diploma Fashion Design Second Year, (How to Design for Fashion In...
Somya Jain, Diploma Fashion Design Second Year, (How to Design for Fashion In...
 
Gitesh Chhatwani , BCA -3 Year
Gitesh Chhatwani , BCA -3 YearGitesh Chhatwani , BCA -3 Year
Gitesh Chhatwani , BCA -3 Year
 
Anurag Yadav , B.Voc Interior Design 1st Year ( Residential Portfolio)
Anurag Yadav , B.Voc Interior Design 1st Year ( Residential Portfolio)Anurag Yadav , B.Voc Interior Design 1st Year ( Residential Portfolio)
Anurag Yadav , B.Voc Interior Design 1st Year ( Residential Portfolio)
 
Namita Bakoliya, Diploma Fashion Design First Year, (Corel Draw Project)
Namita Bakoliya, Diploma Fashion Design First Year, (Corel Draw Project)Namita Bakoliya, Diploma Fashion Design First Year, (Corel Draw Project)
Namita Bakoliya, Diploma Fashion Design First Year, (Corel Draw Project)
 
Sheikh Anjum Firdoush , Diploma Fashion Design Second Year, (Pattern Engineer...
Sheikh Anjum Firdoush , Diploma Fashion Design Second Year, (Pattern Engineer...Sheikh Anjum Firdoush , Diploma Fashion Design Second Year, (Pattern Engineer...
Sheikh Anjum Firdoush , Diploma Fashion Design Second Year, (Pattern Engineer...
 
Sheikh Anjum Firdoush , Diploma Fashion Design Second Year, (Draping Project)
Sheikh Anjum Firdoush , Diploma Fashion Design Second Year, (Draping Project)Sheikh Anjum Firdoush , Diploma Fashion Design Second Year, (Draping Project)
Sheikh Anjum Firdoush , Diploma Fashion Design Second Year, (Draping Project)
 
Gouri Ramchandani, Diploma Fashion Design First Year, (Embroidery Project)
Gouri Ramchandani, Diploma Fashion Design First Year, (Embroidery Project)Gouri Ramchandani, Diploma Fashion Design First Year, (Embroidery Project)
Gouri Ramchandani, Diploma Fashion Design First Year, (Embroidery Project)
 
Gouri Ramchandani, Diploma Fashion Design First Year, (Corel DrawProject)
Gouri Ramchandani, Diploma Fashion Design First Year, (Corel DrawProject)Gouri Ramchandani, Diploma Fashion Design First Year, (Corel DrawProject)
Gouri Ramchandani, Diploma Fashion Design First Year, (Corel DrawProject)
 
Dimple Mordani, Diploma Fashion Design First Year, (illustration for Fashion ...
Dimple Mordani, Diploma Fashion Design First Year, (illustration for Fashion ...Dimple Mordani, Diploma Fashion Design First Year, (illustration for Fashion ...
Dimple Mordani, Diploma Fashion Design First Year, (illustration for Fashion ...
 
Dimple Mordani, Diploma Fashion Design First Year, (Design Basics Project)
Dimple Mordani, Diploma Fashion Design First Year, (Design Basics Project)Dimple Mordani, Diploma Fashion Design First Year, (Design Basics Project)
Dimple Mordani, Diploma Fashion Design First Year, (Design Basics Project)
 
Dimple Mordani, Diploma Fashion Design First Year, (Corel Draw Project)
Dimple Mordani, Diploma Fashion Design First Year, (Corel Draw Project)Dimple Mordani, Diploma Fashion Design First Year, (Corel Draw Project)
Dimple Mordani, Diploma Fashion Design First Year, (Corel Draw Project)
 

Recently uploaded

Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Victor Rentea
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 

Recently uploaded (20)

Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontology
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Introduction to use of FHIR Documents in ABDM
Introduction to use of FHIR Documents in ABDMIntroduction to use of FHIR Documents in ABDM
Introduction to use of FHIR Documents in ABDM
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelMcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital Adaptability
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering Developers
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 

Akshay Sharma,BCA,2nd year

  • 1. Project Report Java Programing Topic Wrapper Class and Nesting Methods Submitted by: Akshay Sharma BCA IInd YEAR Dezyne E’cole College www.dezyneecole.com INFORMATION TECHNOLOGY
  • 2. P a g e 1 | 14 Project Report On Java Programing At Dezyne E’cole College Ajmer Submitted to Dezyne E’cole College Towards The Practical Fulfillment on BCA By Akshay Sharma Dezyne E’cole College 106/10, Civil-lines, Ajmer Tel: 0145-2624679 www.dezyneecole.com Year
  • 3. P a g e 2 | 14 2016-2017 ACKNOWLEDGEMENT I Akshay Sharma, Student Of Dezyne E’cole College, Am Extremely Who Has Grateful To Each And Every Individual Who Has Contributed In Successful Completion Of My Project. I Express My Gratitude Towards Dezyne E’cole College For Their Guidance And Constant Supervision As Well As For Providing The Necessary Information And Support Regarding The Completion Thank You
  • 4. P a g e 3 | 14 SYNOPSIS This Project Is A Miner. Project Made, Based On The Theoretical Concepts Of JAVA. This Project Has Made Our Basic Concepts On Java Strong.
  • 5. P a g e 4 | 14 Wrapper classes As pointed out earlier, vectors cannot handle primitive data types like int, float, char, and double. Primitive data type may be converted into object types by using the wrapper classes contained in the java.lang Package. Following table shows the simple data types and their corresponding wrapper class types. Wrapper Classes for Converting Types Simply Type Wrapper class boolean Boolean char Character double Double float Float Int Integer long Long The wrapper classes have a number of unique methods for handling primitive data type of objects. They are listed in the following tables. Converting Primitive Numbers to Objects Number Using Constructor Method Constructor Calling Conversion Action Integer IntVal=new Integer(i); Primitive integer to Integer Object Float FloatVal=new Float(f); Primitive float to Float Object Double DoubleVal=new Double(d); Primitive double to Double Object Long LongVal=new Long(l); primitive long to Long Object Converting Objects Numbers to Primitive Number Using typeValue () Method Method Calling Conversion Action int i=IntVal.intValue(); Object to Primitive integer float f=FloatVal.floatValue(); Object to Primitive float long l=LongVal.lingValue(); Object to Primitive long double d=DoubleVal.doubleValue(); Object to Primitive double
  • 6. P a g e 5 | 14 Converting Numbers to String Using to String () Method Method Calling Conversion Action str=Integer.toString(i); Primitive integer to string str=Float.toFloat(f); Primitive float to string str=Double.toDouble(d); primitive double to string str=Long.toLong(); primitive long to string Converting String Objects to Numbers Objects Using the Static Method value Of () Method Calling Conversion Action DoubleVal=Double.valueOf(str) Converts string to Double Object FloatVal=Float.valueOf(str) Converts string to Float Object IntVal=Integer.valueOf(str) Converts string to Integer Object LongVal=Long.valueOf(str) Converts string to Long Object Converting Numeric String to Primitive Numbers Using Parsing Methods Method Calling Conversion Action Int i=Integer.parseInt(str) Converts string to primitive integer Float f=Float.parseFloat(str) Converts string to primitive Float long l=Long.praseLong(str) Converts string to primitive Long Double d=Double.praseDouble(str) Converts string to primitive Double Converting Numeric String to Primitive Numbers Using Parsing Methods Method Calling Conversion Action int i=Integer.parseInt(str); Converts string to primitive Integer long l=Long.parseInt(str); Converts string to primitive long
  • 7. P a g e 6 | 14 Converting Primitive Numbers to Object Numbers Output:-
  • 8. P a g e 7 | 14 Converting Object Numbers to Primitive Numbers Output:-
  • 9. P a g e 8 | 14 Converting Number to String Output:-
  • 10. P a g e 9 | 14 Converting String Object to Numeric Object Output:-
  • 11. P a g e 10 | 14 Converting Numeric String to primitive Number Output:-
  • 12. P a g e 11 | 14 AutoBoxing and UnBoxing The auto boxing and unboxing feature, introduced in J2SE 5.0, facilitates the process for handling primitive data types in collections. We can use this feature to convert primitive data types to wrapper class types automatically. The compiler generates a code implicitly to convert primitive type to the corresponding wrapper class type and vice-versa. For example:- Consider the following statements:- Double d=98.42; Double dbl=d.doubleValue (); Using the auto boxing and unboxing feature we can rewrite the above code as:- Double d=98.42; Double dbl=d; How, the java compiler provides restriction to perform the following conversions:  Converts from Null type to any primitive type.  Converts to the Null type 0ther than the identify conversion.  Converts from any class type c to any array type if c is not object.
  • 13. P a g e 12 | 14 Vector without using auto boxing and unboxing Output:-
  • 14. P a g e 13 | 14 Vector with using auto boxing and unboxing Output:-
  • 15. P a g e 14 | 14 THANK YOU