AWS Community Day CPH - Three problems of Terraform
Ā
Nikita Totlani ,BCA 2nd year
1. INFORMATION TECHNOLOGY
PROJECT REPORT
JAVA PROGRAMMING
TOPIC
WRAPPER CLASS AND
NESTING METHOD
SUBMITTED BY:-
NIKITA TOTLANI
BCA-Bechlorās of Computer Application
DEZYNE EāCOLE COLLEGE
www.dezyneecole.com
2. Project Report on
At
Dezyne Eācole College
Ajmer
Submitted To
Dezyne Eācole College
Towards the
Partial Fulfillment
Bechlorās of Computer Application
By
Nikita Totlani
Dezyne Eācole College
106/10,Civil Lines,Ajmer
Tel:-0145-2624679
www.dezyneecole.com
2016-2017
3. ACKNOWLEDGEMENT
I Nikita Totlani,student of Dezyne Eācole College,An Extremely
Greatful To Each And Every Individual Who Hasn
Contributted In Successful Completion Of My Project.
I Express My Gratitute Towards Dezyne Eācole College For
Their Gudiance And Constant Supervision As Well As For
Provding The Necessary Information And Support Regarding
The Completion Of Project.
Thank You
4. Synopsis
This Project Is a Minar Project,Mode,Based On The
Theoritical Concepts Of Java.This Project Has Made Our Basic
Concepts On Java Strong.
5.
6. Wrapper Classes
As pointed out earlier, vectors cannot handle primitive data types like int,float,long, char
and double.Primitive data types 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 wapper class types.
Wrappers classes for converting simple types
Smiple Type Wrapper Classes
Boolean Boolean
Char Char
Double Double
Float Float
Int Int
Long Long
The wrapper classes have a number of unique methods for handling primitive data types
and objects.They are listed in the following tables.
Converting primitive numbers to object number using constructor methods:-
Constructor Calling Conversion Action
Integer IntVal=new Integer(i) Primitive integer to Integer Object
Float FloatVal=new Float Primitive float to Float Object
Double DoubleVal=new Double Primitive double to Double Object
Long LongVal=new Long Primitive long to Long Object
Converting object numbers to primitive numbers using type Value()method
Method Calling Conversion Action
Int i=IntVal.intValue(); Object to primitive integer
float f=FloatVal.FloatValue(); Object to primitive float
long l =LongVal.LongValue(); Object to primitive long
double d=DoubleVal.doubleValue(); Object to primitive double
7. Converting numbers to strings using toString() method
Method Calling Conversion Action
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 objects to numeric objects using the Static method
Valueof()
Method Calling Conversion Action
IntVal=Integer.Valueof(str); Convert string to Integer object
FloatVal=Float.Valueof(str); Convert string to Float object
LongVal=Long.Valueof(str); Convert string to Long object
DoubleVal=Double.Valueof(str); Convert string to Double object
Converting numeric strings to primitive numbers using parsing methods
Method Calling Conversion Action
int i=Integer.parseInt(str); Convert string to primitive Integer
long l=Long.parselong(str); Convert string to primitive long
13. Auto Boxing and UnBoxing:-
The auto boxing and unboxing feature introduced in J2SE SO facilities the
process of handling primitive data types in collection we can use this features
to convert primitive data type to wapper class types automatically.The
compiler generates a code implicity to convert primitive type to the
corresponding wrapper classes type an d vice-versa.
For Example:-
Consider the following statement:-
Double d=98.42
double dbl=a.double value();
Using the auto boxing and un boxing feature,we can rewrite the above coade
as:-
Double d=98.42;
double dbl=d;
How,the java complier provides restriction to perform the following
conversions:-
. Convert from null type to any primitive type.
. Convert to the null type other than the identify conversion.
. Convert from any class type C to any type if C is not object.
16. 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 hame by another method of the same class.This is known as
Nesting of methods.
The class Nesting defines one constructor and two methods,numely largest ()
and display ().The method display() calls the method largest() to determine the
largest of the two numbers and then display the result.