Advertisement
Xetos

StringTokenizer - betuk szama

Apr 20th, 2016
192
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.35 KB | None | 0 0
  1. import java.util.StringTokenizer;
  2.  
  3. public class Main {
  4.  
  5.     public static void main(String[] args) {
  6.         String s = "sor amit tordelni kell";
  7.         StringTokenizer st = new StringTokenizer(s);
  8.         int hossz=0;
  9.         while(st.hasMoreTokens()){
  10.             String resz = st.nextToken();
  11.             hossz+=resz.length();
  12.         }
  13.        
  14.         System.out.println("Betuk szama: "+hossz);
  15.  
  16.     }
  17.  
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement