0 Replies - 279 Views - Last Post: 03 February 2018 - 05:27 AM Rate Topic: -----

#1 Xhertus  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 17
  • Joined: 03-February 18

I don't understand why I get mistakes.

Posted 03 February 2018 - 05:27 AM

public String toUpperCase(String str)
{
String result = "";
int length = str.length;
for(int i = length; i < 0; i--)
{
char cur = str.charAt(i);
Character.toUpperCase(cur);
Character.toString(cur);
cur+= result;
}
return result;
}

Hello dear members, I am new on this forum and new at coding. I don't understand why, but I got some errors at line 4 and line 12. It says length is out of scope at line 4 and at line 12, it says String cannot be converted to char (but I have informed that Character.toString method does that job). I am waiting for advice and solutions.

Is This A Good Question/Topic? 0
  • +

Page 1 of 1