if statement with string

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • griffon
    New Member
    • Feb 2008
    • 1

    #1

    if statement with string

    I'm fairly new to Java. I'm trying to write an if statement so if the first letter of a name is a certain letter, it's placed in a certain category. How do I specify for just the first letter? So far I have:

    if(Name ==

    Thanks
  • BigDaddyLH
    Recognized Expert Top Contributor
    • Dec 2007
    • 1216

    #2
    Originally posted by griffon
    I'm fairly new to Java. I'm trying to write an if statement so if the first letter of a name is a certain letter, it's placed in a certain category. How do I specify for just the first letter? So far I have:

    if(Name ==

    Thanks
    Have you discovered the API: http://java.sun.com/javase/6/docs/api/
    In it are the answers to your next 1,000 questions, but for starters, look up java.lang.Strin g and find the method you need to answer this question.

    Comment

    Working...