File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

casting String into double

 
umut uzumcu
Ranch Hand
Posts: 43
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Can anybody help me to sort this out please.

class..
{
Object p=pList.getCap(); //either this
String s=pList.getCap(); //or this

//here I need to cast the Object or String (any will do) into double
//to send it as an argument to coldDrinks(int, double) method
sDB.coldDrinks(++coldDrinkNo,softDrinkPrice);
}


other class
{
Object/String getCap()
{
}
}


other class
{
coldDrinks(int, double)
{..}
}


Thanks in advance.
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24204
34
Chrome Eclipse IDE Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, the question is, what does getCap() actually return? Is it a String? If so, look at the static parseDouble() method in the java.lang.Double class.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic