Tuesday 27 November 2012

WRAPPER CLASSES...CONT

i)XXXVALUE ():
      We can use these means for modifying  wrapper item to basic value. Every variety kind wrapper category (byte, brief, integer, lengthy, flow, double) the following xxxvalue technique (xxxvalue ()) for transforming wrapper item basic kind.

           Community byte bytevalue ();
           Community brief shortvalue ();
           public in intvalue ();
           Community lengthy longvalue ();
           Community flow floatvalue ();
           Community dual double ();

          Integer I = new Integer (130);
          Program.out.println(I.bytevalue()); // -126
          Program.out.println(I.shortvalue()); // 130
          Program.out.println(I.intvalue()); // 130
          Program.out.println(I.longvalue()); // 130
          Program.out.println(I.floatvalue()); // 130
          Program.out.println(I.doublevalue()); // 130.0


CHARVALUE ():-
       Personality category contains char value means for transforming  character item to char basic.

                      Community char charvalue ();
                      Personality ch = new character ('a');
                      char ch1 = ch . charvalue ();

BOOLEANVALUE():
        Boolean category contain booleanValue() to discover boolean basic for the given boolean wrappr item.

                 Community Boolean Booleanvlaue ();
                 //Blooean b = new Boolean("naresh");
                 Boolean b = Boolean.valueof ("NARESH");
                 Program.out.println(b.Booleanvalue());  // false

NOTE:
      In complete 38 (=6*6+1+1) xxx value techniques as possible
PAREXXX():
     These means for transforming sequence purpose to corresponding basic .

FORM-I:
      Every wrapper category anticipate personality category contains the following fixed bag xxx() public fixed basic parse xxx (string str)

EX:
          Int I=Integer.parseInt("10");
          Double d=double.parsedouble("10.5");
          Boolean b = Boolean.parseBoolean("true");
Every integer kind wrapper category contains the following parseXXX().
          Community fixed anyprimitive(return type) parseXXX (string s, int radix);

EX:

           Int i = integer.parseInt("1010"2);
           Program.out.println(8);// "1.5"

FORM -II:
     Every wrapper category contains a sequence to sequence means for modifying basic value to pattern by public fixed sequence to sequence (primitive p).
        EX:
                String s = Boolean.toString(true)
FORM - III:
              Integer and lengthy sessions contains the following toString() for transforming int or lengthy value into specification

         Community fixed Strin to String (primitive p, int radix 2 to 36)
         String s1 =Integer. toString (10/);
         Program.out.println(s1); // "1010"
         String s1 = lengthy.toString (101,16);
         Program.out.println(s); //"a"

FORM IV:
        Integer & Long sessions contains the following toXXXstring() methods

    public fixed sequence toBinaryString (primitive p)
    Community fixed String toOctalString(primitive p)
    public fixed String toHexaString (primitive p

                            String s1 = Integer.toBinaryString(12);
                            Program.out.println(s1)//100
                            String s2 = Long.oHexaString(100l);
                            Ystem.out.println (s2);//64


PARTIAL HIERARCHY OF JAVA. LANG PACKAGE
String
String barrier String builder
math
number ->byte, Short,Integer, lons, Float, Double
Character
Boolean
Void

     Some periods gap is also handled as wrapper class
He wrapper sessions which are not kid sessions of number/ character/ Boolean
In the lang program, the following sessions are final
         1) String, sequence designer, all wrapper sessions
In including to sequence all wrap sessions are immutable i.e once we designed an item we are prohibited to modify its material.

No comments:

Post a Comment