Logo 
Search:

Java Answers

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds
  Question Asked By: Madeleine Hughes   on Jul 22 In Java Category.

  
Question Answered By: Aabirah Khan   on Jul 22

i would like to make an imp correction my mail that u can't DIRECTLY cast  a
String to any other type.
But u have functions provided in Wrapper classes to convert a String into
primitive data types;

Integer.parseInt(String);
Double.parseDouble(String);
Long.parseLong(String);
Float.parseFloat(String);

Boolean.valueOf(String); //True / False
Byte.valueOf(String);
Short.valueOf(String);

& all of Wrapper classes having their constructors with String type :)
new Integer(String);
new Double(String);
new Long(String);
new Float(String);
new Boolean(String);
new Byte(String);
new Short(String);

Share: 

 

This Question has 2 more answer(s). View Complete Question Thread

 
Didn't find what you were looking for? Find more on casting in java Or get search suggestion and latest updates.


Tagged: