• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

What am I doing wrong? toUppercase()

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am learning about strings right now, and this part of my assignment is giving me trouble. Im trying to captialize only the first letter that I'm pulling from the array using the get method.

I keep getting "cannot find symbol" for toUpperCase for the following:

Obviously more in the method, just posted that part that I cant figure out. What am I doing wrong here?

[moderation comment] added code tags, fixed indentation.
 
Sheriff
Posts: 67618
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to the Ranch.

You didn't show us where word gets declared.

Also, in future posts please UseCodeTags when posting code. Thanks.
 
M Newmark
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Bear Bibeault wrote:Welcome to the Ranch.

You didn't show us where word gets declared.

Also, in future posts please UseCodeTags when posting code. Thanks.



Thanks, and will do..
 
Rancher
Posts: 1007
26
Netbeans IDE Oracle MySQL Database Tomcat Server C++ Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Look in your class Word, it is not a String. See if there is anything there that will give you a String to use.

M Newmark wrote:

Bear Bibeault wrote:Welcome to the Ranch.

You didn't show us where word gets declared.

Also, in future posts please UseCodeTags when posting code. Thanks.



Thanks, and will do..

 
Marshal
Posts: 74617
335
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Unless Word#getNoun returns a String, you will be in the realms of StringBuilder#append(Object) which calls the toString method or adds “null” for a null.
What does your Word class represent? Is it a word, or a phrase?

Can you put all the words into your StringBuilder as they are, then iterate the StringBuilder looking for spaces, and capitalise the first char following. The Character class probably has a method to convert to upper case. Beware of ß in German which turns into two letters in upper case: SS.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic