SlideShare une entreprise Scribd logo
1  sur  19
Télécharger pour lire hors ligne
1
INFORMATION TECHNOLOGY
JAVA PROGRAMME
TOPIC
Wrapper Class And
Nesting Method
SUBMITTED BY
Kaushal Soni
BCA-IInd
Year
Dezyne E’cole College
www.dezyneecole.com
2
Project Report
On
Java Programme
At
Dezyne E’cole College
Ajmer
Submitted To
Dezyne E’cole College
Towards The
Partial Fulfillment
BCA
(Bachelor Of Computer Application)
By
Kaushal Soni
Dezyne E’Cole College
106/10, Civil Lines, Ajmer
Tel.0145-2624679
www.dezyneecole.com
2016-2017
3
ACKNOWLEDGEMENT
I Am Kaushal Soni, Student Of Dezyne E’Cole College, Am Extremely 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 Constants Supervision As Well As For Providing The
Necessary Information And Support Regarding The Completion Of Project.
4
SYNOPSIS
This Project Is A Miner. Project Made Based on the Theatrical Concepts of
JAVA .This Project Has Made Our Basic Concept on JAVA Strong
5
Wrapper classes
As pointed out earlier, vectors cannot handle primitive data type types like int, float,
char and double. Primitive data types may be converted into object types by using
the wrapper classes contained in the java. package, following table shows the simple
data types and their corresponding wrapper class types.
Wrapper classes for converting types
Simple 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
types and object. They are listed in the following tables.
Converting primitive numbers to object number using constructor method
Constructor calling Conversion action
Integer IntVal=new Integer() Primitive integer to Integer object.
Float FloatVal=new float(); 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 object numbers to primitive number using type value() method
Method calling Conversion action
Int i=IntVal.int value(); Object to primitive integer
float f=FloatVal.float value(); Object to primitive float
Long l=LongVal.long value(); Object to primitive long
Double d=DoubleVal.double value(); Object to primitive double
Converting numbers to string using to string() method
Method calling Conversion action
Str=integertostring(); Primitive integer to string
Str=floattofloat(); Primitive float to string
Str=DoubletoDouble(); Primitive double to string
str=Long toLong(); Primitive long to string
6
Converting String Objects To Numbers Objects Using The Static Method
valueOff()
Method calling Conversion
Double val=Double valueOff(str); Converts string to Double objects.
Float val=Float valueOff(str); Converts string to Float objects.
Int val=Integer valueOff(str); Converts string to Integer objects.
Long val=Long valueOff(str); Converts string to Long objects.
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.
7
Converting Primitive Number To Object Number
8
Converting Object Number To Primitive Number
9
Convert Number To String
10
Converting String Object To Numeric Object
11
Converting Numeric String To Primitive Number
12
Auto boxing And Unboxing
The auto boxing and Unboxing feature, introduced in j2se 5.0, facilities the process of
handling primitive data types in collections. We can use the this feature to convert
primitive data types to wrapper class types automatically. The compiler generates a
code implicitly to convert primitive types to the corresponding wrapper class type and
vice versa. For example, consider the following statements:
Double d_object= 98.42;
Double d_primitive=d_object;
Using the autoboxing and unboxing feature, we can rewrite the above code as:
Double d_object= 98.42;
Double d_primitive= d_object;
How, the java compiler 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.
Convert from any class type C to any array type if C is not object.
13
Vector Without Using Autoboxing And Unboxing
14
Vector With Using Autoboxing And Unboxing
15
Nesting Of Methods
We discussed earlier that a method of a class can be called only by an object of that
class (or class itself, in the case of static methods) using the dot operator. However,
there is an exception to this. A method can be called by using only its name by another
method of the same class. This is known as nesting of methods.
Program illustrated the nesting of method 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.
16
Nesting Of Methods
17
Nesting Of Methods
18
A method can called any number of method. It is also possible for a called method1
to call another. This is method1 may call method2, which in turn may call method3.
19
Thank You

Contenu connexe

Tendances

Tendances (20)

Brijesh Peswani,BCA 2nd Year
Brijesh Peswani,BCA 2nd YearBrijesh Peswani,BCA 2nd Year
Brijesh Peswani,BCA 2nd Year
 
Pinkle Makhijani ,BCA 2nd Year
Pinkle  Makhijani ,BCA 2nd YearPinkle  Makhijani ,BCA 2nd Year
Pinkle Makhijani ,BCA 2nd Year
 
Amit Kumar Yadav ,BCA
Amit Kumar Yadav ,BCAAmit Kumar Yadav ,BCA
Amit Kumar Yadav ,BCA
 
Karishma Dhanwani,BCA 2nd Year
Karishma Dhanwani,BCA 2nd YearKarishma Dhanwani,BCA 2nd Year
Karishma Dhanwani,BCA 2nd Year
 
Pooja Sharma ,BCA 2nd Year
Pooja Sharma ,BCA 2nd YearPooja Sharma ,BCA 2nd Year
Pooja Sharma ,BCA 2nd Year
 
Ram Prasad ,BCA 2nd Year
Ram Prasad ,BCA 2nd YearRam Prasad ,BCA 2nd Year
Ram Prasad ,BCA 2nd Year
 
Kajal Gaharwal,BCA 2nd Year
Kajal Gaharwal,BCA 2nd YearKajal Gaharwal,BCA 2nd Year
Kajal Gaharwal,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
 
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
 
Ronak Kachhawa,BCA 2nd Year
Ronak Kachhawa,BCA 2nd YearRonak Kachhawa,BCA 2nd Year
Ronak Kachhawa,BCA 2nd Year
 
Deepak Soni,BCA 2nd Year
Deepak Soni,BCA 2nd YearDeepak Soni,BCA 2nd Year
Deepak Soni,BCA 2nd Year
 
Varun Kaushik, BCA 2nd Year
Varun Kaushik, BCA 2nd YearVarun Kaushik, BCA 2nd Year
Varun Kaushik, BCA 2nd Year
 
Bhanu Pratap Singh ,BCA
Bhanu Pratap Singh ,BCA Bhanu Pratap Singh ,BCA
Bhanu Pratap Singh ,BCA
 
Yashika Soni, BCA 2nd Year
Yashika Soni, BCA 2nd YearYashika Soni, BCA 2nd Year
Yashika Soni, BCA 2nd Year
 
Reshma Kodwani,BCA,2nd Year
Reshma Kodwani,BCA,2nd YearReshma Kodwani,BCA,2nd Year
Reshma Kodwani,BCA,2nd Year
 
Shivani Chouhan ,BCA ,2nd Year
Shivani Chouhan ,BCA ,2nd YearShivani Chouhan ,BCA ,2nd Year
Shivani Chouhan ,BCA ,2nd Year
 
Daksh Sharma ,BCA 2nd Year
Daksh  Sharma ,BCA 2nd YearDaksh  Sharma ,BCA 2nd Year
Daksh Sharma ,BCA 2nd Year
 
Farhaan Ahmed, BCA 2nd Year
Farhaan Ahmed, BCA 2nd YearFarhaan Ahmed, BCA 2nd Year
Farhaan Ahmed, BCA 2nd Year
 
Rahul Saini, BCA 2nd Year
Rahul Saini, BCA 2nd YearRahul Saini, BCA 2nd Year
Rahul Saini, BCA 2nd Year
 
Pooja Sharma , BCA Third Year
Pooja Sharma , BCA Third YearPooja Sharma , BCA Third Year
Pooja Sharma , BCA Third Year
 

Similaire à Kaushal Soni,BCA,2nd Year

Presentation 4th
Presentation 4thPresentation 4th
Presentation 4th
Connex
 
Cso gaddis java_chapter6
Cso gaddis java_chapter6Cso gaddis java_chapter6
Cso gaddis java_chapter6
RhettB
 

Similaire à Kaushal Soni,BCA,2nd Year (11)

Wrapper classes
Wrapper classesWrapper classes
Wrapper classes
 
BCA 2nd year Java prog. File
BCA 2nd year Java prog. FileBCA 2nd year Java prog. File
BCA 2nd year Java prog. File
 
Gaurav Singh Chouhan, BCA 2nd Year
Gaurav Singh Chouhan, BCA 2nd YearGaurav Singh Chouhan, BCA 2nd Year
Gaurav Singh Chouhan, BCA 2nd Year
 
Harendra Singh Rawat,BCA 2nd Year
Harendra Singh Rawat,BCA 2nd YearHarendra Singh Rawat,BCA 2nd Year
Harendra Singh Rawat,BCA 2nd Year
 
Kirti Kumawat
Kirti KumawatKirti Kumawat
Kirti Kumawat
 
Samarth Gaur ,BCA 2nd Year
Samarth Gaur ,BCA 2nd YearSamarth Gaur ,BCA 2nd Year
Samarth Gaur ,BCA 2nd Year
 
Akshay Sharma,BCA,2nd year
Akshay Sharma,BCA,2nd yearAkshay Sharma,BCA,2nd year
Akshay Sharma,BCA,2nd year
 
Ravi Prakash,BCA,2nd Year
Ravi Prakash,BCA,2nd YearRavi Prakash,BCA,2nd Year
Ravi Prakash,BCA,2nd Year
 
Presentation 4th
Presentation 4thPresentation 4th
Presentation 4th
 
Java sessionnotes
Java sessionnotesJava sessionnotes
Java sessionnotes
 
Cso gaddis java_chapter6
Cso gaddis java_chapter6Cso gaddis java_chapter6
Cso gaddis java_chapter6
 

Plus de dezyneecole

Plus de 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)
 

Dernier

Dernier (20)

From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 

Kaushal Soni,BCA,2nd Year

  • 1. 1 INFORMATION TECHNOLOGY JAVA PROGRAMME TOPIC Wrapper Class And Nesting Method SUBMITTED BY Kaushal Soni BCA-IInd Year Dezyne E’cole College www.dezyneecole.com
  • 2. 2 Project Report On Java Programme At Dezyne E’cole College Ajmer Submitted To Dezyne E’cole College Towards The Partial Fulfillment BCA (Bachelor Of Computer Application) By Kaushal Soni Dezyne E’Cole College 106/10, Civil Lines, Ajmer Tel.0145-2624679 www.dezyneecole.com 2016-2017
  • 3. 3 ACKNOWLEDGEMENT I Am Kaushal Soni, Student Of Dezyne E’Cole College, Am Extremely 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 Constants Supervision As Well As For Providing The Necessary Information And Support Regarding The Completion Of Project.
  • 4. 4 SYNOPSIS This Project Is A Miner. Project Made Based on the Theatrical Concepts of JAVA .This Project Has Made Our Basic Concept on JAVA Strong
  • 5. 5 Wrapper classes As pointed out earlier, vectors cannot handle primitive data type types like int, float, char and double. Primitive data types may be converted into object types by using the wrapper classes contained in the java. package, following table shows the simple data types and their corresponding wrapper class types. Wrapper classes for converting types Simple 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 types and object. They are listed in the following tables. Converting primitive numbers to object number using constructor method Constructor calling Conversion action Integer IntVal=new Integer() Primitive integer to Integer object. Float FloatVal=new float(); 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 object numbers to primitive number using type value() method Method calling Conversion action Int i=IntVal.int value(); Object to primitive integer float f=FloatVal.float value(); Object to primitive float Long l=LongVal.long value(); Object to primitive long Double d=DoubleVal.double value(); Object to primitive double Converting numbers to string using to string() method Method calling Conversion action Str=integertostring(); Primitive integer to string Str=floattofloat(); Primitive float to string Str=DoubletoDouble(); Primitive double to string str=Long toLong(); Primitive long to string
  • 6. 6 Converting String Objects To Numbers Objects Using The Static Method valueOff() Method calling Conversion Double val=Double valueOff(str); Converts string to Double objects. Float val=Float valueOff(str); Converts string to Float objects. Int val=Integer valueOff(str); Converts string to Integer objects. Long val=Long valueOff(str); Converts string to Long objects. 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.
  • 7. 7 Converting Primitive Number To Object Number
  • 8. 8 Converting Object Number To Primitive Number
  • 10. 10 Converting String Object To Numeric Object
  • 11. 11 Converting Numeric String To Primitive Number
  • 12. 12 Auto boxing And Unboxing The auto boxing and Unboxing feature, introduced in j2se 5.0, facilities the process of handling primitive data types in collections. We can use the this feature to convert primitive data types to wrapper class types automatically. The compiler generates a code implicitly to convert primitive types to the corresponding wrapper class type and vice versa. For example, consider the following statements: Double d_object= 98.42; Double d_primitive=d_object; Using the autoboxing and unboxing feature, we can rewrite the above code as: Double d_object= 98.42; Double d_primitive= d_object; How, the java compiler 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. Convert from any class type C to any array type if C is not object.
  • 13. 13 Vector Without Using Autoboxing And Unboxing
  • 14. 14 Vector With Using Autoboxing And Unboxing
  • 15. 15 Nesting Of Methods We discussed earlier that a method of a class can be called only by an object of that class (or class itself, in the case of static methods) using the dot operator. However, there is an exception to this. A method can be called by using only its name by another method of the same class. This is known as nesting of methods. Program illustrated the nesting of method 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.
  • 18. 18 A method can called any number of method. It is also possible for a called method1 to call another. This is method1 may call method2, which in turn may call method3.