Advertisement
kanciastopantalones

Zad 2 duża pierwsza ostatnia

Dec 6th, 2016
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class Excercise6 {
  4. public static void main (String [] args){
  5.  
  6. Scanner keyboard = new Scanner (System.in);
  7. System.out.print("Please Type a word: ");
  8. String word = keyboard.nextLine();
  9.  
  10. int stringLength = word.length();
  11. String letter1 = word.substring (0,1);
  12. String lastletter = word.substring ((stringLength-1),(stringLength));
  13. String newWord =letter1.toUpperCase() + lastletter.toUpperCase();
  14.  
  15.  
  16. System.out.println("The word with first letter capitalized is: " + newWord );
  17.  
  18. }
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement