SlideShare a Scribd company logo
INFORMATION TECHNOLOGY
Project Report
Java Programming
Topic
Wrapper Class and
Nesting Method
Submited By
Sudarshan Joshi
BCA - II year
Dezyne E’cole College
www.dezyneecol.com
1
Project Report
On
Java Program
At
Dezyne E’cole College
Ajmer
Submitted to
Dezyne E’cole College
Towards The
Partial Fulfillment on
BCA
(Bachelor of Computer Application)
By
Sudarshan Joshi
Dezyne E’cole College
106/10, Civil Lines, Ajmer
Tel.-0145-2624679
www.dezyneecole.com
2016-2017
2
ACKNOWLEDGMENT
I Sudarshan Joshi, Student Of Dezyne E’cole College, An Extremely Granted 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 Of Project.
THANK YOU.
3
Synopsis
This project is a Miner project Made, based on The Theoretical Concept of Java This
Project has made our Basic Concept on Java Strong.
4
Wrapper Classes:-
As pointer out earlier, vectors cannot handle primitive data type 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 class have a number of unique methods for handling primitive data type and
objects. They are listed in the following table.
Converting Primitive number to object number using Constructor
method:-
Constructor Calling Conversion Active
Integer intval =new Integer(i); Primitive integer to Integer Object
Float floattval =new Float(f); Primitive float to Float Object
Double doubletval =new Double(d); Primitive double to Double Object
Long longval =new Long(l); Primitive long to Long Object
Converting object number to Primitive number using typevalue ()
method:-
Method Calling Conversion Active
Int i=Integer.intValue(); Object to primitive integer
float f=Float.floatValue(); Object to primitive Float
double d=Double.doubleValue(); Object to primitive Double
long l=Long.longValue(); Object to primitive Long
5
Converting Number to String using toString () method:-
Method Calling Conversion Active
str=Integer.toString(i); primitive integer to string
str=Float.toString(f); primitive Float to string
str=Double.toString(d); primitive Double to string
str=Long.toString(l); primitive Long to string
Converting String object to Numeric objects using the String Method
valueOf ():-
Method Calling Conversion Active
IntegerVal=Integer.valueOf(str) Converts string to Integer object
FloatVal=Float.valueOf(str) Converts string to Float object
DoubleVal=Double.valueOf(str) Converts string to Double object
LongVal=Long.valueOf(str) Converts string to Long object
Converting Numeric String to Primitive Number using Parsing
method:-
Method Calling Conversion Active
Int i=Integer.parseInt(str); Converting String to Primitive integer
Long l=Long.parseLong(str); Converting String to Primitive long
6
1.Convert Primitive number to object numbers:-
Output:-
7
2. Convert object numbers to Primitive number:-
Output:-
8
3.Converting Number to String:-
Output:-
9
4.Convert String object to Numeric object:-
Output:-
10
5.Convert Numeric String to Primitive Number:-
Output:-
11
Auto Boxing and Unboxing:-
The auto boxing and unboxing feature, introduced in J2SE 5.0 facilitates the process of
handling primitive data type in collections. We can use this feature to convert primitive
data type to wrapper class type 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 statement:-
Double d=98.42;
double dbl=d.doubleVlaue();
Using the auto boxing and unboxing feature, we can rewrite the avoid code as:
Double d=98.42;
Double dbl =d;
How, the java complier provides restrictions to perform the following conversions:-
1. Convert from null type to any primitive type
2. Convert to the null type other than the identify conversion.
3. Convert from any class type C to any array type if C is not object.
12
6.Vector without using auto boxing and unboxing:-
Output:-
13
7. Vector with using auto boxing and unboxing:-
Output:-
Method of Nesting:-
We discuss earlier that a method of the class can be called by an object of that class (or
class itself, in the case of static methods) using the dot operator. How’s, ever there is an
exception to this. A method can be called by using its name by another method of the same class.
This is known as Nesting of methods.
Program illustrates the nesting of methods inside a class . The class Nesting
defines one constructor and two methods, namely largest() and display() . The method
display() calls the method largest() to determine the largest of the two numbers and
then display the result.
14
1.Nesting of method:-
Output:-
A method can call any number of methods. It is also possible for a called method to call
another method. This is, method 1 may call method 2, which is turn may call method 3.
15
2.Another example of Nesting of Method :-
Output:-
16
Thank You

More Related Content

PDF
Kaushal Soni,BCA,2nd Year
PDF
Rakesh Bijawat , BCA Third Year
PDF
Rakesh Bijawat, BCA 2nd Year
PDF
Deepika Mittal,BCA ,2nd Year
PDF
Amit Kumar Yadav ,BCA
PDF
Rounit Mathur,BCA 2nd year.
PDF
Karishma Dhanwani,BCA 2nd Year
PDF
Brijesh Peswani,BCA 2nd Year
Kaushal Soni,BCA,2nd Year
Rakesh Bijawat , BCA Third Year
Rakesh Bijawat, BCA 2nd Year
Deepika Mittal,BCA ,2nd Year
Amit Kumar Yadav ,BCA
Rounit Mathur,BCA 2nd year.
Karishma Dhanwani,BCA 2nd Year
Brijesh Peswani,BCA 2nd Year

What's hot (20)

PDF
Shaikh Mohammad Usman Haider ,BCA 2nd Year
PDF
Pooja Sharma ,BCA 2nd Year
PDF
Ram Prasad ,BCA 2nd Year
PDF
Ravi Sharma,BCA 2nd Year
PDF
Pinkle Makhijani ,BCA 2nd Year
PDF
Bhanu Pratap Singh ,BCA
PDF
Kajal Gaharwal,BCA 2nd Year
PDF
Aanchal Gupta,BCA 2nd year
PDF
Ronak Kachhawa,BCA 2nd Year
PDF
Yashika Soni, BCA 2nd Year
PDF
Shivani Chouhan ,BCA ,2nd Year
PDF
Reshma Kodwani,BCA,2nd Year
PDF
Farhaan Ahmed, BCA 2nd Year
PDF
Mithlesh Singh Rawat, BCA 2nd Year
PDF
Daksh Sharma ,BCA 2nd Year
PDF
Pooja Sharma , BCA Third Year
PDF
Nikita Totlani ,BCA 2nd year
PDF
Deepak Soni,BCA 2nd Year
PDF
Varun Kaushik, BCA 2nd Year
PDF
Harendra Singh Rawat,BCA 2nd Year
Shaikh Mohammad Usman Haider ,BCA 2nd Year
Pooja Sharma ,BCA 2nd Year
Ram Prasad ,BCA 2nd Year
Ravi Sharma,BCA 2nd Year
Pinkle Makhijani ,BCA 2nd Year
Bhanu Pratap Singh ,BCA
Kajal Gaharwal,BCA 2nd Year
Aanchal Gupta,BCA 2nd year
Ronak Kachhawa,BCA 2nd Year
Yashika Soni, BCA 2nd Year
Shivani Chouhan ,BCA ,2nd Year
Reshma Kodwani,BCA,2nd Year
Farhaan Ahmed, BCA 2nd Year
Mithlesh Singh Rawat, BCA 2nd Year
Daksh Sharma ,BCA 2nd Year
Pooja Sharma , BCA Third Year
Nikita Totlani ,BCA 2nd year
Deepak Soni,BCA 2nd Year
Varun Kaushik, BCA 2nd Year
Harendra Singh Rawat,BCA 2nd Year
Ad

Viewers also liked (12)

PDF
Logo Rotterdams Offensief
PDF
Cob 20090722 2
PDF
приволжский цсо проект академия добра
DOCX
Activity 4 creating graph
PPTX
IDIOMAS NEGOCIOS
DOCX
достижения
PPT
Protista alemi
PDF
Size does matter - Patterns for high scalability: Uwe Friedrichsen
PPT
Understanding the need for security measures
DOCX
документ Microsoft word
PDF
Akshay sharma,BS.c-Fashion Technology,+2 years Diploma
PDF
Fashion Technology Portfolio Vinita Punjabi B.Sc. Fashion Technology,Dezyne E...
Logo Rotterdams Offensief
Cob 20090722 2
приволжский цсо проект академия добра
Activity 4 creating graph
IDIOMAS NEGOCIOS
достижения
Protista alemi
Size does matter - Patterns for high scalability: Uwe Friedrichsen
Understanding the need for security measures
документ Microsoft word
Akshay sharma,BS.c-Fashion Technology,+2 years Diploma
Fashion Technology Portfolio Vinita Punjabi B.Sc. Fashion Technology,Dezyne E...
Ad

Similar to Sudarshan Joshi,BCA 2nd Year (11)

PDF
Samarth Gaur ,BCA 2nd Year
PDF
Gaurav Singh Chouhan, BCA 2nd Year
PDF
Wrapper classes
PDF
Ravi Prakash,BCA,2nd Year
PDF
BCA 2nd year Java prog. File
PDF
Rahul Saini, BCA 2nd Year
PDF
Akshay Sharma,BCA,2nd year
PDF
Kirti Kumawat
PPTX
vectors.(join ALL INDIA POLYTECHNIC (AICTE)).pptx
PPTX
Data types in java
Samarth Gaur ,BCA 2nd Year
Gaurav Singh Chouhan, BCA 2nd Year
Wrapper classes
Ravi Prakash,BCA,2nd Year
BCA 2nd year Java prog. File
Rahul Saini, BCA 2nd Year
Akshay Sharma,BCA,2nd year
Kirti Kumawat
vectors.(join ALL INDIA POLYTECHNIC (AICTE)).pptx
Data types in java

More from dezyneecole (20)

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

Recently uploaded (20)

PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
Review of recent advances in non-invasive hemoglobin estimation
PPTX
MYSQL Presentation for SQL database connectivity
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PPTX
Big Data Technologies - Introduction.pptx
PDF
Empathic Computing: Creating Shared Understanding
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
Spectral efficient network and resource selection model in 5G networks
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
cuic standard and advanced reporting.pdf
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PPTX
sap open course for s4hana steps from ECC to s4
Per capita expenditure prediction using model stacking based on satellite ima...
Review of recent advances in non-invasive hemoglobin estimation
MYSQL Presentation for SQL database connectivity
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Big Data Technologies - Introduction.pptx
Empathic Computing: Creating Shared Understanding
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Spectral efficient network and resource selection model in 5G networks
“AI and Expert System Decision Support & Business Intelligence Systems”
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Network Security Unit 5.pdf for BCA BBA.
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
cuic standard and advanced reporting.pdf
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Digital-Transformation-Roadmap-for-Companies.pptx
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
MIND Revenue Release Quarter 2 2025 Press Release
sap open course for s4hana steps from ECC to s4

Sudarshan Joshi,BCA 2nd Year

  • 1. INFORMATION TECHNOLOGY Project Report Java Programming Topic Wrapper Class and Nesting Method Submited By Sudarshan Joshi BCA - II year Dezyne E’cole College www.dezyneecol.com
  • 2. 1 Project Report On Java Program At Dezyne E’cole College Ajmer Submitted to Dezyne E’cole College Towards The Partial Fulfillment on BCA (Bachelor of Computer Application) By Sudarshan Joshi Dezyne E’cole College 106/10, Civil Lines, Ajmer Tel.-0145-2624679 www.dezyneecole.com 2016-2017
  • 3. 2 ACKNOWLEDGMENT I Sudarshan Joshi, Student Of Dezyne E’cole College, An Extremely Granted 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 Of Project. THANK YOU.
  • 4. 3 Synopsis This project is a Miner project Made, based on The Theoretical Concept of Java This Project has made our Basic Concept on Java Strong.
  • 5. 4 Wrapper Classes:- As pointer out earlier, vectors cannot handle primitive data type 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 class have a number of unique methods for handling primitive data type and objects. They are listed in the following table. Converting Primitive number to object number using Constructor method:- Constructor Calling Conversion Active Integer intval =new Integer(i); Primitive integer to Integer Object Float floattval =new Float(f); Primitive float to Float Object Double doubletval =new Double(d); Primitive double to Double Object Long longval =new Long(l); Primitive long to Long Object Converting object number to Primitive number using typevalue () method:- Method Calling Conversion Active Int i=Integer.intValue(); Object to primitive integer float f=Float.floatValue(); Object to primitive Float double d=Double.doubleValue(); Object to primitive Double long l=Long.longValue(); Object to primitive Long
  • 6. 5 Converting Number to String using toString () method:- Method Calling Conversion Active str=Integer.toString(i); primitive integer to string str=Float.toString(f); primitive Float to string str=Double.toString(d); primitive Double to string str=Long.toString(l); primitive Long to string Converting String object to Numeric objects using the String Method valueOf ():- Method Calling Conversion Active IntegerVal=Integer.valueOf(str) Converts string to Integer object FloatVal=Float.valueOf(str) Converts string to Float object DoubleVal=Double.valueOf(str) Converts string to Double object LongVal=Long.valueOf(str) Converts string to Long object Converting Numeric String to Primitive Number using Parsing method:- Method Calling Conversion Active Int i=Integer.parseInt(str); Converting String to Primitive integer Long l=Long.parseLong(str); Converting String to Primitive long
  • 7. 6 1.Convert Primitive number to object numbers:- Output:-
  • 8. 7 2. Convert object numbers to Primitive number:- Output:-
  • 9. 8 3.Converting Number to String:- Output:-
  • 10. 9 4.Convert String object to Numeric object:- Output:-
  • 11. 10 5.Convert Numeric String to Primitive Number:- Output:-
  • 12. 11 Auto Boxing and Unboxing:- The auto boxing and unboxing feature, introduced in J2SE 5.0 facilitates the process of handling primitive data type in collections. We can use this feature to convert primitive data type to wrapper class type 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 statement:- Double d=98.42; double dbl=d.doubleVlaue(); Using the auto boxing and unboxing feature, we can rewrite the avoid code as: Double d=98.42; Double dbl =d; How, the java complier provides restrictions to perform the following conversions:- 1. Convert from null type to any primitive type 2. Convert to the null type other than the identify conversion. 3. Convert from any class type C to any array type if C is not object.
  • 13. 12 6.Vector without using auto boxing and unboxing:- Output:-
  • 14. 13 7. Vector with using auto boxing and unboxing:- Output:- Method of Nesting:- We discuss earlier that a method of the class can be called by an object of that class (or class itself, in the case of static methods) using the dot operator. How’s, ever there is an exception to this. A method can be called by using its name by another method of the same class. This is known as Nesting of methods. Program illustrates the nesting of methods inside a class . The class Nesting defines one constructor and two methods, namely largest() and display() . The method display() calls the method largest() to determine the largest of the two numbers and then display the result.
  • 15. 14 1.Nesting of method:- Output:- A method can call any number of methods. It is also possible for a called method to call another method. This is, method 1 may call method 2, which is turn may call method 3.
  • 16. 15 2.Another example of Nesting of Method :- Output:-