SlideShare a Scribd company logo
BACHELOR OF COMPUTER APPLICATION
Dezyne E’cole College
JAVA PROGRAMMIG
TOPIC: WRAPPER CLASSES & NESTING OF METHOD
INFORMATION TECHNOLOGY
Shaikh Mohammad Usman haider
R
Submitted By
1
Project Report
On
Java Program
At
Dezyne E’cole College
Ajmer
Submitted To
Dezyne E’cole College
Toward The
Practical Fulfillment On
BCA
By
Usman haider
Dezyne E’cole College
106/10, Civil Line Lines, Ajmer
Tel – 0145- 2624679
www.dezyneecole.com
2016-2017
R
2
ACKNOWLEDGMENT
I Shaikh Mohammad Usman Haider, Student of Dezyne E’cole College,
an Externally Grateful To Each And Every Individual Who Has Contribute
In Successful Completion of My Project
I Express My Gratitude Towards Dezyne E’cole College For Their
Guidelines And Constant Supervision As Well For Providing The
Necessary Information And Support Regarding The Completion Of
Project.
Thank You.
3
SYNOPSIS
This Project Is A Minor Project Made, Based On The Theoretical Concept
Of JAVA This Project Has Made Our Basic Concepts Of Java Strong.
4
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 type 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 number of unique method for handling primitive
data types and object. They are listed in the following table.
Converting Primitive Number to Object Number using Constructor Method
Converting Object Number to Primitive Number using typeValue() Method
Constructor Calling Conversion Action
Integer IntVal=new Integer(i); Primitive integer to integer Object
Float floatVal=new flaot(f); Primitive float to float Object
Double DoubleVal=new Double(d); Primitive Double to Double Object
Long lonfgVal=new Long(l); Primitive Long to long Object
Method Calling Conversion Action
int i=IntVal.intValue(); Object to Primitive integer
float f=FloatVal.floatValue(); Object to Primitive Float
Double d=DoubleVal.doubleValue(); Object to Primitive Double
long l=LongVal.longValue(); Object to Primitive long
5
Converting Number to String Using to Stirng() Method
Converting String object to Number Object Using to Static Method ValueOf()
Converting Number String To Primitive Number Using Parsing Methods
Method Calling Conversion Action
Str=Integer.toStiring(i); Primitive integer to String
Str=Float.toFloat(f); Primitive Float to String
Str=Double.toDouble(d); Primitive Double to String
Str=Long.toStiring(l); Primitive Long to String
Method Calling Conversion Action
DoubleVal=Double.valueOf(str); Convert string to Double Object
FloatVal=Float.valueOf(str); Convert string to Float Object
IntVal=Integer.valueOf(str); Convert string to Integer Object
LongVal.Long.valueOf(str); Convert string to Long Object
Method Calling Conversion Action
Int i=integer.parseInt(str); Convert string to primitive integer
float f=Float.parseFlaot(str); Convert string to primitive Float
long l=long.parseLong(str); Convert string to primitive Long
double d=double.parseDouble(str); Convert string to primitive double
6
Converting Primitive number to Object Number
7
Converting Object Number to Primitive Number
8
Converting Number to String
9
Converting String Object to Numeric Object
10
Converting Number String To Primitive Number
Auto Boxing and Unboxing
The auto boxing and unboxing feature, introduce in J2SE 5.0,
facilitates the process of handling primitive data types in collection.
We can use this feature to convert primitive data types to wrapper
class types automatically. The compiling generates code implicitly
to convert primitive type to the corresponding wrapper classes type
and vice versa for example consider the following statement
Double d_object=98.42;
double d_primitive = d_object.doubleValue();
Usimg the auto boxing and unboxing feature we can rewrite the
above code as:
11
Double d_object=98.42;
double d_primitive = d_object;
How the java compile provides restriction to perform the following
conversion.
1. Convert from null type to any primitive type.
2. Convert to null type other than the identify conversion
3. Convert from and class type C to any array type if C is Not
object.
Vector Without using auto boxing and unboxing
12
Vector With using auto boxing and unboxing
Nesting of Method
We discussed earlier that a method of class can be called only by
an object of that class (or class itself, in the class 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 class.
Program illustrate the nesting of class:
The class nesting define one constructor and two method, namely
largest() and display(). The method display() call the method
largest() to determine the largest of the two numbers and then
displays the result.
13
A method can call any number of method. It is also possible for a
called method to call another method. That is, Method 1 may call
Method 2, which in turn may call Method 3.
14

More Related Content

What's hot

What's hot (20)

Aanchal Gupta,BCA 2nd year
Aanchal Gupta,BCA 2nd yearAanchal Gupta,BCA 2nd year
Aanchal Gupta,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
 
Pooja Sharma ,BCA 2nd Year
Pooja Sharma ,BCA 2nd YearPooja Sharma ,BCA 2nd Year
Pooja 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
 
Daksh Sharma ,BCA 2nd Year
Daksh  Sharma ,BCA 2nd YearDaksh  Sharma ,BCA 2nd Year
Daksh Sharma ,BCA 2nd Year
 
Yashika Soni, BCA 2nd Year
Yashika Soni, BCA 2nd YearYashika Soni, BCA 2nd Year
Yashika Soni, BCA 2nd Year
 
Ronak Kachhawa,BCA 2nd Year
Ronak Kachhawa,BCA 2nd YearRonak Kachhawa,BCA 2nd Year
Ronak Kachhawa,BCA 2nd Year
 
Amit Kumar Yadav ,BCA
Amit Kumar Yadav ,BCAAmit Kumar Yadav ,BCA
Amit Kumar Yadav ,BCA
 
Bhanu Pratap Singh ,BCA
Bhanu Pratap Singh ,BCA Bhanu Pratap Singh ,BCA
Bhanu Pratap Singh ,BCA
 
Varun Kaushik, BCA 2nd Year
Varun Kaushik, BCA 2nd YearVarun Kaushik, BCA 2nd Year
Varun Kaushik, BCA 2nd Year
 
Kajal Gaharwal,BCA 2nd Year
Kajal Gaharwal,BCA 2nd YearKajal Gaharwal,BCA 2nd Year
Kajal Gaharwal,BCA 2nd Year
 
Farhaan Ahmed, BCA 2nd Year
Farhaan Ahmed, BCA 2nd YearFarhaan Ahmed, BCA 2nd Year
Farhaan Ahmed, BCA 2nd Year
 
Nikita Totlani ,BCA 2nd year
Nikita Totlani ,BCA 2nd year Nikita Totlani ,BCA 2nd year
Nikita Totlani ,BCA 2nd year
 
Brijesh Peswani,BCA 2nd Year
Brijesh Peswani,BCA 2nd YearBrijesh Peswani,BCA 2nd Year
Brijesh Peswani,BCA 2nd Year
 
Deepak Soni,BCA 2nd Year
Deepak Soni,BCA 2nd YearDeepak Soni,BCA 2nd Year
Deepak Soni,BCA 2nd Year
 
Shivani Chouhan ,BCA ,2nd Year
Shivani Chouhan ,BCA ,2nd YearShivani Chouhan ,BCA ,2nd Year
Shivani Chouhan ,BCA ,2nd Year
 
Rahul Saini, BCA 2nd Year
Rahul Saini, BCA 2nd YearRahul Saini, BCA 2nd Year
Rahul Saini, 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
 

Viewers also liked

Viewers also liked (13)

mobtzu - ecosystem of me - creating mobile experiences
mobtzu - ecosystem of me - creating mobile experiencesmobtzu - ecosystem of me - creating mobile experiences
mobtzu - ecosystem of me - creating mobile experiences
 
Республика Карелия
Республика КарелияРеспублика Карелия
Республика Карелия
 
Krati Taksali, BCA Final Year ,Dezyne E'cole College
Krati Taksali, BCA Final Year ,Dezyne E'cole CollegeKrati Taksali, BCA Final Year ,Dezyne E'cole College
Krati Taksali, BCA Final Year ,Dezyne E'cole College
 
Marco
MarcoMarco
Marco
 
Gall bladder
Gall bladderGall bladder
Gall bladder
 
Testautomatisering SAST Öresund - Jonas Hermansson
Testautomatisering SAST Öresund - Jonas HermanssonTestautomatisering SAST Öresund - Jonas Hermansson
Testautomatisering SAST Öresund - Jonas Hermansson
 
4 ляшок тимченко корр
4 ляшок тимченко корр4 ляшок тимченко корр
4 ляшок тимченко корр
 
Ravi Prakash,BCA,2nd Year
Ravi Prakash,BCA,2nd YearRavi Prakash,BCA,2nd Year
Ravi Prakash,BCA,2nd Year
 
Хоол зоогийн үйлчилгээ
Хоол зоогийн үйлчилгээХоол зоогийн үйлчилгээ
Хоол зоогийн үйлчилгээ
 
Information processing
Information processingInformation processing
Information processing
 
Heena Soni,B.Sc fashion Technology+2 years Diploma
 Heena Soni,B.Sc fashion Technology+2 years Diploma Heena Soni,B.Sc fashion Technology+2 years Diploma
Heena Soni,B.Sc fashion Technology+2 years Diploma
 
Vishal Kumar,B.Sc.-Interior Design +2 years Diploma ID(Commercial Design)
 Vishal Kumar,B.Sc.-Interior Design +2 years Diploma ID(Commercial Design) Vishal Kumar,B.Sc.-Interior Design +2 years Diploma ID(Commercial Design)
Vishal Kumar,B.Sc.-Interior Design +2 years Diploma ID(Commercial Design)
 
Putting Email At The Center Of A Cross-Channel Conversation
Putting Email At The Center Of A Cross-Channel ConversationPutting Email At The Center Of A Cross-Channel Conversation
Putting Email At The Center Of A Cross-Channel Conversation
 

Similar to Shaikh Mohammad Usman Haider ,BCA 2nd Year

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

Similar to Shaikh Mohammad Usman Haider ,BCA 2nd Year (10)

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
 
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
 
Chapter 7:Understanding Class Inheritance
Chapter 7:Understanding Class InheritanceChapter 7:Understanding Class Inheritance
Chapter 7:Understanding Class Inheritance
 
Presentation 4th
Presentation 4thPresentation 4th
Presentation 4th
 
Getting Started - Console Program and Problem Solving
Getting Started - Console Program and Problem SolvingGetting Started - Console Program and Problem Solving
Getting Started - Console Program and Problem Solving
 

More from dezyneecole

More from 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)
 

Recently uploaded

Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo DiehlFuture Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Peter Udo Diehl
 
Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
Safe Software
 

Recently uploaded (20)

Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo DiehlFuture Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
 
How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
 
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
 
ODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User GroupODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User Group
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
 
Powerful Start- the Key to Project Success, Barbara Laskowska
Powerful Start- the Key to Project Success, Barbara LaskowskaPowerful Start- the Key to Project Success, Barbara Laskowska
Powerful Start- the Key to Project Success, Barbara Laskowska
 
When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
 
IoT Analytics Company Presentation May 2024
IoT Analytics Company Presentation May 2024IoT Analytics Company Presentation May 2024
IoT Analytics Company Presentation May 2024
 
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
 
Knowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and backKnowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and back
 
UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3
 
Optimizing NoSQL Performance Through Observability
Optimizing NoSQL Performance Through ObservabilityOptimizing NoSQL Performance Through Observability
Optimizing NoSQL Performance Through Observability
 
Unpacking Value Delivery - Agile Oxford Meetup - May 2024.pptx
Unpacking Value Delivery - Agile Oxford Meetup - May 2024.pptxUnpacking Value Delivery - Agile Oxford Meetup - May 2024.pptx
Unpacking Value Delivery - Agile Oxford Meetup - May 2024.pptx
 
Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
 
Speed Wins: From Kafka to APIs in Minutes
Speed Wins: From Kafka to APIs in MinutesSpeed Wins: From Kafka to APIs in Minutes
Speed Wins: From Kafka to APIs in Minutes
 
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
 
Salesforce Adoption – Metrics, Methods, and Motivation, Antone Kom
Salesforce Adoption – Metrics, Methods, and Motivation, Antone KomSalesforce Adoption – Metrics, Methods, and Motivation, Antone Kom
Salesforce Adoption – Metrics, Methods, and Motivation, Antone Kom
 

Shaikh Mohammad Usman Haider ,BCA 2nd Year

  • 1. BACHELOR OF COMPUTER APPLICATION Dezyne E’cole College JAVA PROGRAMMIG TOPIC: WRAPPER CLASSES & NESTING OF METHOD INFORMATION TECHNOLOGY Shaikh Mohammad Usman haider R Submitted By
  • 2. 1 Project Report On Java Program At Dezyne E’cole College Ajmer Submitted To Dezyne E’cole College Toward The Practical Fulfillment On BCA By Usman haider Dezyne E’cole College 106/10, Civil Line Lines, Ajmer Tel – 0145- 2624679 www.dezyneecole.com 2016-2017 R
  • 3. 2 ACKNOWLEDGMENT I Shaikh Mohammad Usman Haider, Student of Dezyne E’cole College, an Externally Grateful To Each And Every Individual Who Has Contribute In Successful Completion of My Project I Express My Gratitude Towards Dezyne E’cole College For Their Guidelines And Constant Supervision As Well For Providing The Necessary Information And Support Regarding The Completion Of Project. Thank You.
  • 4. 3 SYNOPSIS This Project Is A Minor Project Made, Based On The Theoretical Concept Of JAVA This Project Has Made Our Basic Concepts Of Java Strong.
  • 5. 4 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 type 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 number of unique method for handling primitive data types and object. They are listed in the following table. Converting Primitive Number to Object Number using Constructor Method Converting Object Number to Primitive Number using typeValue() Method Constructor Calling Conversion Action Integer IntVal=new Integer(i); Primitive integer to integer Object Float floatVal=new flaot(f); Primitive float to float Object Double DoubleVal=new Double(d); Primitive Double to Double Object Long lonfgVal=new Long(l); Primitive Long to long Object Method Calling Conversion Action int i=IntVal.intValue(); Object to Primitive integer float f=FloatVal.floatValue(); Object to Primitive Float Double d=DoubleVal.doubleValue(); Object to Primitive Double long l=LongVal.longValue(); Object to Primitive long
  • 6. 5 Converting Number to String Using to Stirng() Method Converting String object to Number Object Using to Static Method ValueOf() Converting Number String To Primitive Number Using Parsing Methods Method Calling Conversion Action Str=Integer.toStiring(i); Primitive integer to String Str=Float.toFloat(f); Primitive Float to String Str=Double.toDouble(d); Primitive Double to String Str=Long.toStiring(l); Primitive Long to String Method Calling Conversion Action DoubleVal=Double.valueOf(str); Convert string to Double Object FloatVal=Float.valueOf(str); Convert string to Float Object IntVal=Integer.valueOf(str); Convert string to Integer Object LongVal.Long.valueOf(str); Convert string to Long Object Method Calling Conversion Action Int i=integer.parseInt(str); Convert string to primitive integer float f=Float.parseFlaot(str); Convert string to primitive Float long l=long.parseLong(str); Convert string to primitive Long double d=double.parseDouble(str); Convert string to primitive double
  • 7. 6 Converting Primitive number to Object Number
  • 8. 7 Converting Object Number to Primitive Number
  • 10. 9 Converting String Object to Numeric Object
  • 11. 10 Converting Number String To Primitive Number Auto Boxing and Unboxing The auto boxing and unboxing feature, introduce in J2SE 5.0, facilitates the process of handling primitive data types in collection. We can use this feature to convert primitive data types to wrapper class types automatically. The compiling generates code implicitly to convert primitive type to the corresponding wrapper classes type and vice versa for example consider the following statement Double d_object=98.42; double d_primitive = d_object.doubleValue(); Usimg the auto boxing and unboxing feature we can rewrite the above code as:
  • 12. 11 Double d_object=98.42; double d_primitive = d_object; How the java compile provides restriction to perform the following conversion. 1. Convert from null type to any primitive type. 2. Convert to null type other than the identify conversion 3. Convert from and class type C to any array type if C is Not object. Vector Without using auto boxing and unboxing
  • 13. 12 Vector With using auto boxing and unboxing Nesting of Method We discussed earlier that a method of class can be called only by an object of that class (or class itself, in the class 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 class. Program illustrate the nesting of class: The class nesting define one constructor and two method, namely largest() and display(). The method display() call the method largest() to determine the largest of the two numbers and then displays the result.
  • 14. 13 A method can call any number of method. It is also possible for a called method to call another method. That is, Method 1 may call Method 2, which in turn may call Method 3.
  • 15. 14