0

I'm working on a Pig Latin method and now I'm trying to do the if-else statement: if Start word is capitalized, lowercase Start and uppercase End. This is so if a word is at the beginning of a sentence or is just capitalized in general (Ex. John), the Pig Latin will capitalize the first letter when translating (Ex. Ohnjay). I cannot figure out why my code won't work, maybe I'm not storing values correctly... I admit straight out>> this is for a homework assignment, if you don't like, don't answer<< Thanks for any help!

            else if (vowel > 0)
            {
                Start = Input.substring(0, vowel);
                End = Input.substring(vowel);
                char StartFirstLetter = Start.charAt(0);
                char EndFirstLetter = End.charAt(0);

                if (Character.isUpperCase(StartFirstLetter) == true)
                {
                    End = Character.toUppercase(EndFirstLetter);
                }
                else
                {
                Result = End + Start +"ay ";
                }

here's the error:

                StringUtil.java:175: error: cannot find symbol
                    End = Character.toUppercase(EndFirstLetter);
                                   ^
                  symbol:   method toUppercase(char)
                  location: class Character
                1 error
Erwin Bolwidt
  • 30,799
  • 15
  • 56
  • 79
Sen Park
  • 11
  • 1
  • 1
  • 2
    If you get errors like `cannot find symbol`, then always read the [JavaDoc](https://docs.oracle.com/javase/7/docs/api/index.html?java/lang/Character.html) of the used class first. This is much faster and easier, than creating a question on Stackoverflow. – Tom Nov 22 '14 at 00:50

3 Answers3

3

Ironically, the c needs to be in uppercase for the toUpperCase method:

Character.toUpperCase(EndFirstLetter);
rgettman
  • 176,041
  • 30
  • 275
  • 357
0

The error means that the method cannot be found, meaning that you have misspelled the method you are trying to call, which is:

Character.toUpperCase(EndFirstLetter)

as rgettman has pointed out. It is useful to try and understand the error messages, as you can learn quite a bit from them.

holtc
  • 1,780
  • 3
  • 16
  • 35
0

Try this:

Character.toUpperCase(EndFirstLetter);
AstroCB
  • 12,337
  • 20
  • 57
  • 73
Dyrandz Famador
  • 4,499
  • 5
  • 25
  • 40