SlideShare une entreprise Scribd logo
1  sur  17
Télécharger pour lire hors ligne
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

Contenu connexe

Tendances

Tendances (20)

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
 
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
 
Ravi Sharma,BCA 2nd Year
Ravi Sharma,BCA 2nd YearRavi Sharma,BCA 2nd Year
Ravi Sharma,BCA 2nd Year
 
Pinkle Makhijani ,BCA 2nd Year
Pinkle  Makhijani ,BCA 2nd YearPinkle  Makhijani ,BCA 2nd Year
Pinkle Makhijani ,BCA 2nd Year
 
Bhanu Pratap Singh ,BCA
Bhanu Pratap Singh ,BCA Bhanu Pratap Singh ,BCA
Bhanu Pratap Singh ,BCA
 
Kajal Gaharwal,BCA 2nd Year
Kajal Gaharwal,BCA 2nd YearKajal Gaharwal,BCA 2nd Year
Kajal Gaharwal,BCA 2nd Year
 
Aanchal Gupta,BCA 2nd year
Aanchal Gupta,BCA 2nd yearAanchal Gupta,BCA 2nd year
Aanchal Gupta,BCA 2nd year
 
Ronak Kachhawa,BCA 2nd Year
Ronak Kachhawa,BCA 2nd YearRonak Kachhawa,BCA 2nd Year
Ronak Kachhawa,BCA 2nd Year
 
Yashika Soni, BCA 2nd Year
Yashika Soni, BCA 2nd YearYashika Soni, BCA 2nd Year
Yashika Soni, BCA 2nd Year
 
Shivani Chouhan ,BCA ,2nd Year
Shivani Chouhan ,BCA ,2nd YearShivani Chouhan ,BCA ,2nd Year
Shivani Chouhan ,BCA ,2nd Year
 
Reshma Kodwani,BCA,2nd Year
Reshma Kodwani,BCA,2nd YearReshma Kodwani,BCA,2nd Year
Reshma Kodwani,BCA,2nd Year
 
Farhaan Ahmed, BCA 2nd Year
Farhaan Ahmed, BCA 2nd YearFarhaan Ahmed, BCA 2nd Year
Farhaan Ahmed, 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
 
Daksh Sharma ,BCA 2nd Year
Daksh  Sharma ,BCA 2nd YearDaksh  Sharma ,BCA 2nd Year
Daksh Sharma ,BCA 2nd Year
 
Pooja Sharma , BCA Third Year
Pooja Sharma , BCA Third YearPooja Sharma , BCA Third Year
Pooja Sharma , BCA Third Year
 
Nikita Totlani ,BCA 2nd year
Nikita Totlani ,BCA 2nd year Nikita Totlani ,BCA 2nd year
Nikita Totlani ,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
 
Harendra Singh Rawat,BCA 2nd Year
Harendra Singh Rawat,BCA 2nd YearHarendra Singh Rawat,BCA 2nd Year
Harendra Singh Rawat,BCA 2nd Year
 

En vedette

Logo Rotterdams Offensief
Logo Rotterdams OffensiefLogo Rotterdams Offensief
Logo Rotterdams Offensief
guest8b68c1
 
достижения
достижениядостижения
достижения
bukish
 
документ Microsoft word
документ Microsoft wordдокумент Microsoft word
документ Microsoft word
bukish
 
Akshay sharma,BS.c-Fashion Technology,+2 years Diploma
 Akshay sharma,BS.c-Fashion Technology,+2 years Diploma  Akshay sharma,BS.c-Fashion Technology,+2 years Diploma
Akshay sharma,BS.c-Fashion Technology,+2 years Diploma
dezyneecole
 

En vedette (12)

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

Similaire à Sudarshan Joshi,BCA 2nd Year

Presentation 4th
Presentation 4thPresentation 4th
Presentation 4th
Connex
 

Similaire à Sudarshan Joshi,BCA 2nd Year (11)

Wrapper classes
Wrapper classesWrapper classes
Wrapper classes
 
Gaurav Singh Chouhan, BCA 2nd Year
Gaurav Singh Chouhan, BCA 2nd YearGaurav Singh Chouhan, BCA 2nd Year
Gaurav Singh Chouhan, 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
 
Rahul Saini, BCA 2nd Year
Rahul Saini, BCA 2nd YearRahul Saini, BCA 2nd Year
Rahul Saini, 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
 
Ch.1 oop introduction, classes and objects
Ch.1 oop introduction, classes and objectsCh.1 oop introduction, classes and objects
Ch.1 oop introduction, classes and objects
 
Presentation 4th
Presentation 4thPresentation 4th
Presentation 4th
 
Java sessionnotes
Java sessionnotesJava sessionnotes
Java sessionnotes
 

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

Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
vu2urc
 

Dernier (20)

Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
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?
 
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 Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
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
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
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
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
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
 
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
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
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
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
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
 
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
 
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
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 

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