Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
Upcoming SlideShare
Chirag Janani E-commerce Project
Next
Download to read offline and view in fullscreen.

0

Share

Download to read offline

Amit Kumar Yadav ,BCA

Download to read offline

java project,student of Dezyne E'cole College ,www.dezyneecole.com

Related Books

Free with a 30 day trial from Scribd

See all

Related Audiobooks

Free with a 30 day trial from Scribd

See all
  • Be the first to like this

Amit Kumar Yadav ,BCA

  1. 1. TOPIC Wrapper class and Nesting Method SUBMITTED BY Amit Kumar Yadav BCA IInd YEAR Dezyne E’cole College www.dezyneecole.com 2016-2017 R INFORMATION TECHNOLOGY PROJECT REPORT JAVA PROGRAMMING R
  2. 2. Project Report On Java Programming At Dezyne E’cole College Ajmer Submitted to Dezyne E’cole College Towards the Partial fulfillment on Bachelor computer application By Amit Kumar Yadav Dezyne E’cole College 106/10, Civil lines, Ajmer Tel:-0145-2624679 www.dezyneecole.com 2016-2017 R
  3. 3. ACKNOWLEDGMENT I Amit Kumar Yadav, student of Dezyne E’cole College, an 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 super vision as well as for providing the necessary information and support regarding the completion of project. Thank you
  4. 4. SYNOPSIS This project is a minor. Project made, based on The Theoretical concepts of Java this Project has made our basic concepts on Java strong.
  5. 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 classed 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 Char double Double float Float int Int long Long The wrapper classes have a number of unique methods for handling primitive data type and objects. They are listed int the following tables. Converting 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=new Long(l); Primitive long to Long Object Converting Object Numbers to Primitive Number Using typeValue() 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 Converting Numbers to String Using to String() Method Method Calling Conversion Action str=Interger.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
  6. 6. Converting String Objects to Number Objects Using Static Method valueOf() Method Calling Conversion Action DoubleVal=Double.valueOf(str); Converts string to Double object FloatVal=Float.valueOf(str); Converts string to Float object IntVal=Integer.valueOf(str); Converts string to Integer object LongVal=Long.valueOf(str); Converts string to Long object Converting Numeric String to Primitive Number Using Parsing Method Method Calling Conversion Action Int i=Integer.parseInt(str); Convert String to primitive integer Float f=Float.parseFloat(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. 7. Converting Primitive Number to Object Number Converting Object Number to primitive Number
  8. 8. Converting Number to String Converting String Object to Numeric Object
  9. 9. Converting Numeric String to primitive Numbers:
  10. 10. AutoBoxing and Unboxing The autoboxing and unboxing feature, introduced 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 compiler generates a code implicitly to convert primitive type 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.doubleValue(); 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:  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 array type if C is not object. Vector without using autoboxing and unboxing Vector with using autoboxing and unboxing
  11. 11. Nesting of method 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 method) 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 illustrate the nesting of method inside a class. The class Nesting define one Constructor and two methods, namely largest() and display(). The method display() calls the method largest() to determine the largest of the two number and then display the result. Example of Nesting of method
  12. 12. Another Example of Nesting of method
  13. 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. 14. Thank you

java project,student of Dezyne E'cole College ,www.dezyneecole.com

Views

Total views

130

On Slideshare

0

From embeds

0

Number of embeds

0

Actions

Downloads

1

Shares

0

Comments

0

Likes

0

×