SlideShare une entreprise Scribd logo
1  sur  15
Télécharger pour lire hors ligne
INFORMATION TECHNOLOGY
PROJECT REPORT
JAVA PROGRAMMING
TOPIC
WRAPPER CLASS AND
NESTED METHODS
SUBMITTED BY
RESHMA KODWANI
BCA II YEAR
DEZYNE E’COLE COLLEGE
www.dezyneecole.com
2016-2017
R
Project Report
On
Java Programming
At
Dezyne E’cole College
Ajmer
Submitted To
Dezyne E’cole College
Towards The
Partial Fulfillment On
BCA (Bachelor of Computer Application)
By
Reshma Kodwani
Dezyne E’cole College
106/10,Civil Lines, Ajmer
Tel-0145-2624679
Www.Dezyneecole.Com
2016-2017 Year
R
ACKNOWLEDGMENT
I Reshma 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 Constant Supervision As Well As
For Providing The Necessary Information And Support Regarding The
Completion Of Project.
Thank You
Synopsis
This Project Is A Minor Project Made, Based On The Theoretical Concept
Of JAVA. This Project Has Made Our Basis Concepts On JAVA Strong.
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
Simple type Wrapper class
boolean Boolean
Char Character
Double Double
Float Float
Int Integer
Long Long
The wrapper classes have a member of unique methods for handling primitive data type and
objects. They are listed in the following tables.
Constructor Primitive Numbers to Object 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=newLong(l); Primitive long to Long Object
Converting Object Numbers to Primitive Number Using Type Value()Method
Method Calling Conversion Action
int i=IntVal intValue(); Object to primitive integer
float f=Float Val.floatValue(); Object to primitive float
long l=LongVal.longValue(); Object to primitive long
double=DoubleVal.doubleValue(); Object to primitive double
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(l); Primitive long to string
Converting String Objects to Numbers Objects Using the Static Method valueOf()
Method Calling Conversion Action
DoubleVal=Double.valueOff(str); Converts string to Double object
FloatVal=Float.valueOff(str); Converts string to Float object
IntVal=Integer.valueOff(str); Converts string to Integer object
longVal=Long.valueOff(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 parselong(str); Converts string to primitive long
Double d =double parsedouble(str); Converts string to primitive double
Converting Primitive Numbers to Object Number
Converting Object Number to Primitive Number
Converting Number to String
Converting String Objects to Numberic Objects
Converting Numeric String to Primitive Number
Auto boxing and Unboxing
The autoboxing and unboxing features,introduced in J2SE5.0 facilitates the process of handing
primitive data type in collections.We can use this features to convert primitive data type to
wrapper class types automatically.The compiler generates the code implicitly to convert primitive
type to corresponding wrapper class type and vice-versa.For example ,consider the following
statement.
Double d_object =97.77;
Double d_primitive=d_object.doubleValue();
Using the autoboxing and unboxing feature,we can rewrite the above code as:
Double d_object =97.77;
Double d_primitive=d_object;
How,the Java compiler provides restrictions to perform the following conversions:
 Convert form null type to any primitive type.
 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.
Vector without using Autoboxing and Unboxing
Vector with using Autoboxing and Unboxing
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 ,this 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 displays the result.
Nesting of methods
Another example of nesting of methods
A method can call any number of methods.it is also possible for a called method to call another
method.That is,method1 may call method 2,which in turn may call method 3.

Contenu connexe

Tendances

Tendances (20)

Deepika Mittal,BCA ,2nd Year
Deepika Mittal,BCA ,2nd Year Deepika Mittal,BCA ,2nd Year
Deepika Mittal,BCA ,2nd Year
 
Shivani Chouhan ,BCA ,2nd Year
Shivani Chouhan ,BCA ,2nd YearShivani Chouhan ,BCA ,2nd Year
Shivani 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
 
Amit Kumar Yadav ,BCA
Amit Kumar Yadav ,BCAAmit Kumar Yadav ,BCA
Amit Kumar Yadav ,BCA
 
Kajal Gaharwal,BCA 2nd Year
Kajal Gaharwal,BCA 2nd YearKajal Gaharwal,BCA 2nd Year
Kajal Gaharwal,BCA 2nd Year
 
Pooja Sharma ,BCA 2nd Year
Pooja Sharma ,BCA 2nd YearPooja Sharma ,BCA 2nd Year
Pooja Sharma ,BCA 2nd Year
 
Ravi Sharma,BCA 2nd Year
Ravi Sharma,BCA 2nd YearRavi Sharma,BCA 2nd Year
Ravi Sharma,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
 
Deepak Soni,BCA 2nd Year
Deepak Soni,BCA 2nd YearDeepak Soni,BCA 2nd Year
Deepak Soni,BCA 2nd Year
 
Ram Prasad ,BCA 2nd Year
Ram Prasad ,BCA 2nd YearRam Prasad ,BCA 2nd Year
Ram Prasad ,BCA 2nd Year
 
Nikita Totlani ,BCA 2nd year
Nikita Totlani ,BCA 2nd year Nikita Totlani ,BCA 2nd year
Nikita Totlani ,BCA 2nd year
 
Gaurav Singh Chouhan, BCA 2nd Year
Gaurav Singh Chouhan, BCA 2nd YearGaurav Singh Chouhan, BCA 2nd Year
Gaurav Singh Chouhan, BCA 2nd Year
 
Daksh Sharma ,BCA 2nd Year
Daksh  Sharma ,BCA 2nd YearDaksh  Sharma ,BCA 2nd Year
Daksh Sharma ,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
 
Kaushal Soni,BCA,2nd Year
Kaushal Soni,BCA,2nd YearKaushal Soni,BCA,2nd Year
Kaushal Soni,BCA,2nd Year
 
Rahul Saini, BCA 2nd Year
Rahul Saini, BCA 2nd YearRahul Saini, BCA 2nd Year
Rahul Saini, BCA 2nd Year
 
Farhaan Ahmed, BCA 2nd Year
Farhaan Ahmed, BCA 2nd YearFarhaan Ahmed, BCA 2nd Year
Farhaan Ahmed, BCA 2nd Year
 
Varun Kaushik, BCA 2nd Year
Varun Kaushik, BCA 2nd YearVarun Kaushik, BCA 2nd Year
Varun Kaushik, BCA 2nd Year
 
Sudarshan Joshi,BCA 2nd Year
Sudarshan Joshi,BCA 2nd Year Sudarshan Joshi,BCA 2nd Year
Sudarshan Joshi,BCA 2nd Year
 

En vedette

Art Hll7512 Melomano
Art   Hll7512 MelomanoArt   Hll7512 Melomano
Art Hll7512 Melomano
LR MUSIC
 
план курсов гроиро 2015
план курсов гроиро 2015план курсов гроиро 2015
план курсов гроиро 2015
bukish
 
The english language week
The english language weekThe english language week
The english language week
bukish
 
алгоритм выбора профессии
алгоритм выбора профессииалгоритм выбора профессии
алгоритм выбора профессии
bukish
 

En vedette (11)

лагерь непоседы 2016 для сайта
лагерь непоседы 2016 для сайталагерь непоседы 2016 для сайта
лагерь непоседы 2016 для сайта
 
Art Hll7512 Melomano
Art   Hll7512 MelomanoArt   Hll7512 Melomano
Art Hll7512 Melomano
 
план курсов гроиро 2015
план курсов гроиро 2015план курсов гроиро 2015
план курсов гроиро 2015
 
The english language week
The english language weekThe english language week
The english language week
 
алгоритм выбора профессии
алгоритм выбора профессииалгоритм выбора профессии
алгоритм выбора профессии
 
‘New Digital Repertoires for Social Justice, Politics, and Culture?: Explori...
‘New Digital Repertoires for Social Justice, Politics, and Culture?:  Explori...‘New Digital Repertoires for Social Justice, Politics, and Culture?:  Explori...
‘New Digital Repertoires for Social Justice, Politics, and Culture?: Explori...
 
Precedent studies project 1 brief
Precedent studies project 1 briefPrecedent studies project 1 brief
Precedent studies project 1 brief
 
Adclick Africa Facebook Retargeting Media Offering
Adclick Africa Facebook Retargeting Media OfferingAdclick Africa Facebook Retargeting Media Offering
Adclick Africa Facebook Retargeting Media Offering
 
Email In the Age of the Connected Consumer
Email In the Age of the Connected ConsumerEmail In the Age of the Connected Consumer
Email In the Age of the Connected Consumer
 
What To Give the Consumer Who Wants Everything
What To Give the Consumer Who Wants EverythingWhat To Give the Consumer Who Wants Everything
What To Give the Consumer Who Wants Everything
 
FUNDAMENTOS DEL ARTE II. TEMA 4. MODERNISMO
 FUNDAMENTOS DEL ARTE II. TEMA 4. MODERNISMO FUNDAMENTOS DEL ARTE II. TEMA 4. MODERNISMO
FUNDAMENTOS DEL ARTE II. TEMA 4. MODERNISMO
 

Similaire à Reshma Kodwani,BCA,2nd Year

C Sharp: Basic to Intermediate Part 01
C Sharp: Basic to Intermediate Part 01C Sharp: Basic to Intermediate Part 01
C Sharp: Basic to Intermediate Part 01
Zafor Iqbal
 
Presentation 4th
Presentation 4thPresentation 4th
Presentation 4th
Connex
 

Similaire à Reshma Kodwani,BCA,2nd Year (11)

Brijesh Peswani,BCA 2nd Year
Brijesh Peswani,BCA 2nd YearBrijesh Peswani,BCA 2nd Year
Brijesh Peswani,BCA 2nd Year
 
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
 
Pooja Sharma , BCA Third Year
Pooja Sharma , BCA Third YearPooja Sharma , BCA Third Year
Pooja Sharma , BCA Third 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
 
C Sharp: Basic to Intermediate Part 01
C Sharp: Basic to Intermediate Part 01C Sharp: Basic to Intermediate Part 01
C Sharp: Basic to Intermediate Part 01
 
Presentation 4th
Presentation 4thPresentation 4th
Presentation 4th
 
Java tutorial for Beginners and Entry Level
Java tutorial for Beginners and Entry LevelJava tutorial for Beginners and Entry Level
Java tutorial for Beginners and Entry Level
 

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

Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 

Dernier (20)

What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
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
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
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...
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.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
 
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
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
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?
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
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
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
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
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 

Reshma Kodwani,BCA,2nd Year

  • 1. INFORMATION TECHNOLOGY PROJECT REPORT JAVA PROGRAMMING TOPIC WRAPPER CLASS AND NESTED METHODS SUBMITTED BY RESHMA KODWANI BCA II YEAR DEZYNE E’COLE COLLEGE www.dezyneecole.com 2016-2017 R
  • 2. Project Report On Java Programming At Dezyne E’cole College Ajmer Submitted To Dezyne E’cole College Towards The Partial Fulfillment On BCA (Bachelor of Computer Application) By Reshma Kodwani Dezyne E’cole College 106/10,Civil Lines, Ajmer Tel-0145-2624679 Www.Dezyneecole.Com 2016-2017 Year R
  • 3. ACKNOWLEDGMENT I Reshma 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 Constant Supervision As Well As For Providing The Necessary Information And Support Regarding The Completion Of Project. Thank You
  • 4. Synopsis This Project Is A Minor Project Made, Based On The Theoretical Concept Of JAVA. This Project Has Made Our Basis Concepts On JAVA Strong.
  • 5. 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 Simple type Wrapper class boolean Boolean Char Character Double Double Float Float Int Integer Long Long The wrapper classes have a member of unique methods for handling primitive data type and objects. They are listed in the following tables. Constructor Primitive Numbers to Object 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=newLong(l); Primitive long to Long Object Converting Object Numbers to Primitive Number Using Type Value()Method Method Calling Conversion Action int i=IntVal intValue(); Object to primitive integer float f=Float Val.floatValue(); Object to primitive float long l=LongVal.longValue(); Object to primitive long double=DoubleVal.doubleValue(); Object to primitive double
  • 6. 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(l); Primitive long to string Converting String Objects to Numbers Objects Using the Static Method valueOf() Method Calling Conversion Action DoubleVal=Double.valueOff(str); Converts string to Double object FloatVal=Float.valueOff(str); Converts string to Float object IntVal=Integer.valueOff(str); Converts string to Integer object longVal=Long.valueOff(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 parselong(str); Converts string to primitive long Double d =double parsedouble(str); Converts string to primitive double
  • 7. Converting Primitive Numbers to Object Number
  • 8. Converting Object Number to Primitive Number Converting Number to String
  • 9.
  • 10. Converting String Objects to Numberic Objects
  • 11. Converting Numeric String to Primitive Number
  • 12. Auto boxing and Unboxing The autoboxing and unboxing features,introduced in J2SE5.0 facilitates the process of handing primitive data type in collections.We can use this features to convert primitive data type to wrapper class types automatically.The compiler generates the code implicitly to convert primitive type to corresponding wrapper class type and vice-versa.For example ,consider the following statement. Double d_object =97.77; Double d_primitive=d_object.doubleValue(); Using the autoboxing and unboxing feature,we can rewrite the above code as: Double d_object =97.77; Double d_primitive=d_object; How,the Java compiler provides restrictions to perform the following conversions:  Convert form null type to any primitive type.  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. Vector without using Autoboxing and Unboxing
  • 13. Vector with using Autoboxing and Unboxing
  • 14. 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 ,this 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 displays the result. Nesting of methods
  • 15. Another example of nesting of methods A method can call any number of methods.it is also possible for a called method to call another method.That is,method1 may call method 2,which in turn may call method 3.