fork(1) download
  1. import java.util.*;
  2. import java.lang.*;
  3.  
  4. class Ideone {
  5. public static void main (String[] args) {
  6. solve("Teste");
  7. }
  8. public static void solve(String text) {
  9. int len = text.length();
  10. StringBuffer buffer = new StringBuffer(len);
  11. for(int i = 0; i < len; i++){
  12. char letter = text.charAt(i);
  13. buffer.append(i % 2 == 0 ? Character.toUpperCase(letter) : Character.toLowerCase(letter));
  14. }
  15. System.out.println(buffer);
  16. }
  17. }
Success #stdin #stdout 0.06s 380224KB
stdin
Standard input is empty
stdout
TeStE