Advertisement
Guest User

Untitled

a guest
Mar 23rd, 2017
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.99 KB | None | 0 0
  1. /*
  2. * To change this license header, choose License Headers in Project Properties.
  3. * To change this template file, choose Tools | Templates
  4. * and open the template in the editor.
  5. */
  6. package tostring;
  7.  
  8. import java.util.Scanner;
  9.  
  10. /**
  11. *
  12. * @author PC
  13. */
  14. public class ToString {
  15.  
  16. /**
  17. * @param args the command line arguments
  18. */
  19. public static void main(String[] args) {
  20. // TODO code application logic here
  21. // System.out.print("Nhap ten cua ban: ");
  22. // Scanner br = new Scanner(System.in);
  23. // String name = br.nextLine();
  24. // String s1 = name.substring(0, 1).toUpperCase();
  25. // String nameCapitalized = s1 + name.substring(1);
  26. // System.out.println(nameCapitalized);
  27. System.out.print("Nhap ten cua ban: ");
  28. Scanner a = new Scanner(System.in);
  29. String name = a.nextLine();
  30. System.out.print("Nhap so thu tu chu cai can in hoa: ");
  31. int stt = a.nextInt();
  32. String s = name.charAt(stt).toUpperCase();
  33. System.out.println(s+ name);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement