i need to add this criteria to my program:
"if the user enters a last name in small letters the program should display the surname with the first character in capitals"

Can some1 please help me with some examples for this??

i really need it..
thank you guys :)

Look at the methods available on the String class.

char first = myString.charAt(0);
char newFirst;
if ('first' >='a' && <= 'z'){ //if is a lowercase char
    newFirst = first-32;//32 is the difference from lowercase to capital
}
else{//*maybe some other error checking*
    newFirst = first;
}

Attached is a great ASCII table.

Hope this helps

It's never a good idea to code Java using an ASCII table. Java is Unicode, and many countries regularly use letters that are not in the first 127 positions.
To convert a character that may be anything such that any lower case letter is replaced by its upper case equivalent in the character set of the current locale (and anything else is left unchanged), use the toUpperCase method in Char.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.