I am trying to code this:
The int t contains an integer between 1 and 50 (inclusive). Write code that outputs the number in words and stores the result in the String inwords. For example, if t is 35 then inwords should contain "thirty five".
int t = 35;
String inwords;
inwords = Integer.toString(t);
if (inwords.substring(0, 1) == "3")
inwords.substring(0, 1) = "thirty";
else
;
This is not my whole code, I was just seeing if it can work. It didn't though; it brought up an error:
TC1.java:22: unexpected type
required: variable
found : value
inwords.substring(0, 1) = "thirty";
^
Any suggestions?