Advertisement
adrianodassis

PP 16/09 Strings

Sep 16th, 2016
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.34 KB | None | 0 0
  1. package pp1609a;
  2.  
  3. import java.util.StringTokenizer;
  4.  
  5. public class Pp1609a {
  6.  
  7.     public static void main(String[] args) {
  8.         StringBuffer str = new StringBuffer("Java");
  9.         str.insert(3, " ");
  10.         System.out.println(str);
  11.         System.out.println("");
  12.  
  13.         StringBuffer str1 = new StringBuffer("Java");
  14.         str1.insert(4, " ");
  15.         System.out.println(str1);
  16.         System.out.println(str1.length());
  17.         System.out.println("");
  18.  
  19.         StringBuffer str2 = new StringBuffer("Java");
  20.         str2.insert(2, "Programming");
  21.         System.out.println(str2);
  22.         System.out.println(str2.length());
  23.        
  24.         System.out.println(" ");
  25.         System.out.println(str2.reverse());
  26.        
  27.         System.out.println(" ");
  28.         System.out.println(str2.deleteCharAt(1));
  29.        
  30.         System.out.println(" ");
  31.         System.out.println(str2.delete(0, 1));
  32.        
  33.         System.out.println(" ");
  34.         System.out.println(str2.delete(11, 14));
  35.        
  36.         System.out.println(" ");
  37.         System.out.println(str2.reverse());
  38.        
  39.         System.out.println(" ");
  40.         StringTokenizer strt = new StringTokenizer("Olá queridos alunos de Práticas");
  41.        
  42.         while (strt.hasMoreTokens()){
  43.             System.out.println(strt.nextToken());
  44.         }
  45.  
  46.     }
  47.  
  48. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement