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
Wrapper classes
PDF
Gaurav Singh Chouhan, BCA 2nd Year
PDF
BCA 2nd year Java prog. File
PDF
Rahul Saini, BCA 2nd Year
PDF
Kirti Kumawat
PDF
Samarth Gaur ,BCA 2nd Year
PDF
Akshay Sharma,BCA,2nd year
PDF
Ravi Prakash,BCA,2nd Year
PPTX
Ch.1 oop introduction, classes and objects
PDF
Object Oriented Programming notes provided
PPTX
Presentation 4th
Wrapper classes
Gaurav Singh Chouhan, BCA 2nd Year
BCA 2nd year Java prog. File
Rahul Saini, BCA 2nd Year
Kirti Kumawat
Samarth Gaur ,BCA 2nd Year
Akshay Sharma,BCA,2nd year
Ravi Prakash,BCA,2nd Year
Ch.1 oop introduction, classes and objects
Object Oriented Programming notes provided
Presentation 4th

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)

PPT
What is a Computer? Input Devices /output devices
PPTX
Benefits of Physical activity for teenagers.pptx
PDF
Enhancing emotion recognition model for a student engagement use case through...
PPTX
O2C Customer Invoices to Receipt V15A.pptx
PDF
Hindi spoken digit analysis for native and non-native speakers
PDF
How ambidextrous entrepreneurial leaders react to the artificial intelligence...
PDF
NewMind AI Weekly Chronicles – August ’25 Week III
PDF
A novel scalable deep ensemble learning framework for big data classification...
PDF
STKI Israel Market Study 2025 version august
PPTX
Group 1 Presentation -Planning and Decision Making .pptx
PDF
Unlock new opportunities with location data.pdf
PDF
Assigned Numbers - 2025 - Bluetooth® Document
PDF
A review of recent deep learning applications in wood surface defect identifi...
PDF
Univ-Connecticut-ChatGPT-Presentaion.pdf
PDF
Getting started with AI Agents and Multi-Agent Systems
PPTX
Final SEM Unit 1 for mit wpu at pune .pptx
PPTX
observCloud-Native Containerability and monitoring.pptx
PPTX
Chapter 5: Probability Theory and Statistics
PDF
Getting Started with Data Integration: FME Form 101
PDF
DP Operators-handbook-extract for the Mautical Institute
What is a Computer? Input Devices /output devices
Benefits of Physical activity for teenagers.pptx
Enhancing emotion recognition model for a student engagement use case through...
O2C Customer Invoices to Receipt V15A.pptx
Hindi spoken digit analysis for native and non-native speakers
How ambidextrous entrepreneurial leaders react to the artificial intelligence...
NewMind AI Weekly Chronicles – August ’25 Week III
A novel scalable deep ensemble learning framework for big data classification...
STKI Israel Market Study 2025 version august
Group 1 Presentation -Planning and Decision Making .pptx
Unlock new opportunities with location data.pdf
Assigned Numbers - 2025 - Bluetooth® Document
A review of recent deep learning applications in wood surface defect identifi...
Univ-Connecticut-ChatGPT-Presentaion.pdf
Getting started with AI Agents and Multi-Agent Systems
Final SEM Unit 1 for mit wpu at pune .pptx
observCloud-Native Containerability and monitoring.pptx
Chapter 5: Probability Theory and Statistics
Getting Started with Data Integration: FME Form 101
DP Operators-handbook-extract for the Mautical Institute

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:-