I'm trying to convert a wrapper back to string, but for some reason I can't seem to get my variable to drop into my method correctly. Here's what I have:
Conversion.java (Java Class File)
Code:
/*
* Conversion.java
*
* Created on March 2, 2005, 6:38 PM
*/
package Chapter6Project1;
public class Conversion
{
/** Creates a new instance of Conversion */
public Conversion()
{
}
public Integer stringToInteger1(String s) throws Exception
{
int i = Integer.parseInt(s);
Integer iwResult = new Integer(i);
System.out.println(i);
return iwResult;
}
public Double stringToDouble1(String t) throws Exception
{
double d = Double.parseDouble(t);
Double iwResult2 = new Double(d);
System.out.println(d);
return iwResult2;
}
public String wrapperToString(Integer u) throws Exception
{
String str = u.toString();
String iwResult3 = new String(str);
System.out.println("test " + str + iwResult3 + u);
// String iwResult3 = toString(sresult);
return iwResult3;
}
}
ConversionTester.java (Main)
Code:
package Chapter6Project1;
public class ConversionTester
{
public ConversionTester()
{
}
public static void main(String[] args) throws Exception
{
Conversion aConversion = new Conversion();
aConversion.stringToInteger1("5");
aConversion.stringToDouble1("5.5");
aConversion.wrapperToString("6");
// aConversion.wrapperToString("8");
Integer u = new Integer("6");
}
}
As you can see, I can pass the Integer and Double through thier methods, but for some reason the wrapperToString method I can't exactly pass and Integer through (hence the commented out aConversion statement in the ConversionTester file).
TIA