could someone please help me figure out why the console will display only 0 but never 455555?
also, when I run the program, I get the following error (no compiler error, interestingly enough)
java.lang.Numbe rFormatExceptio n: For input string: "+okay+"
at java.lang.Numbe rFormatExceptio n.forInputStrin g(NumberFormatE xception.java:4 8)
at java.lang.Integ er.parseInt(Int eger.java:447)
at java.lang.Integ er.<init>(Integ er.java:620)
at Test.main(Test. java:10)
Code:
public class Test
{
public static void main(String[] args)
{
String testString = "0";
if (testString.equals("0"))
{
String okay=testString.replace("0", "455555");
}
int test = new Integer("+okay+");
System.out.print("test");
}
}
java.lang.Numbe rFormatExceptio n: For input string: "+okay+"
at java.lang.Numbe rFormatExceptio n.forInputStrin g(NumberFormatE xception.java:4 8)
at java.lang.Integ er.parseInt(Int eger.java:447)
at java.lang.Integ er.<init>(Integ er.java:620)
at Test.main(Test. java:10)
Comment