[Logo]
Forums Register Login
casting String into double
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.
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.
Wink, wink, nudge, nudge, say no more ... https://richsoil.com/cards


This thread has been viewed 647 times.

All times above are in ranch (not your local) time.
The current ranch time is
Sep 18, 2018 09:37:50.