6 mar 2010

Wrappers


//ok
Boolean b=true;
Boolean b2 = new Boolean("True");
Boolean b22 = new Boolean("trUe");
assertEquals(b22, b2); //pass
assertTrue(b22==true); //pass

Boolean b3= new Boolean(null);
assertTrue(b3==false); //pass

Boolean b4= new Boolean("Yes");
assertTrue(b4==false); //pass

if(b4){/*Do sth:D*/} //ok

//Integer
Integer x=Integer.valueOf("1011", 2);
prn(x); //11
//Float
float f= Float.valueOf("3.14f");
prn(f); //3.14

Brak komentarzy:

Prześlij komentarz