Monday 26 November 2012

WRAPPER CLASSES...CONT

Flow category contains three constructor one can take float as the discussion the second can take pattern as the discussion 8 the other dual as discussion.
       Flow f= new Flow (10.5 f);
       Flow f+ new float ("10.5f);
       Flow f= new float (10.5D);


    Personality category contains only one constructor which can take corresponding char as discussion there is no character which can take sequence discussion.

       character ch = new character ('a');
       character ch = new character ("a");

  Boolean category also contains two constructors one can take Boolean basic as the discussion & other can take sequence discussion.

   If we are moving Boolean basic the permitted any factor as the discussion also is not essential material is also not essential if the material as us insensitive of real the it is handled as other sensible it is handled as incorrect.

WHICH OF THE FOLLOWING BOOLEAN DECLARATION ARE VALID

    Boolean b1 = new Boolean (true);
    Boolean b2 = new Boolean (true);
    Boolean b3 = new Boolean ("true");
    Boolean b4 = new Boolean ("false");
    Boolean b5 = new Boolean ("hai ramesh");  // False
    Boolean b6 = new Boolean ("true 123");   //False


CONSIDER THE FOLLOWING DECLARATION:

    Boolean b1 = new Boolean ("YES");
    Boolean b2 = new Boolean ("NO");

      Program.out.println(b1);//false
      Program.out.println(b2);//false
      Program.out.println(b1.equals (b2));//true
      Program.out.println(b1==b2);//false


UTILITY METHODS:

    valueof()
    xxxvalue ()
    parseXXX()
    toString ()


VALUEOF()
      We can use value of () means for the development of wrapper item as substitute to constructor
FORM I:
     Every wrapper category except character category contain a fixed value of means for transforming sequence to corresponding wrapper item.
       community fixed any wrapper class(return kind ) valueof (String s)
EX:
           Integer i = Integer.valueOf("10");
           Boolean B = Boolean.valueOf("true");
           Personality ch = character.valueOf ("a");

FROM II:
     Every wrapper category such as character category contain a fixed value of technique altering basic to corresponding wrapper object
       community fixed any wrapper class(return type) value of (primitive p)
Ex:
       Integer i= Integer.valueOf(10);
       Personality ch = character.valueof('a');
       Boolean B = Boolean.valueOf(true);

FROM III:
         Every integer kind wrapper category [byte , brief, integer, long] contains the following value of technique.

  Public fixed anywrapperclass(return type) valueof(string s, int radix)
  The permitted principles for the radix are 1-36
       Integer i=integer value of (1010,2);

No comments:

Post a Comment