At the time of writing this document, eclipse 3.2.2 did not support for each control structure.

import java.io.*;
import java.lang.String.*;
//javac for_each_euivalent_3.java
//class commandline.java
class for_each_euivalent_3{
public static void main(String arguments[])throws IOException

{
InputStreamReader isr = new InputStreamReader(System.in);
BufferedReader br = new BufferedReader(isr);
//needs throws IOException
System.out.print("Type some thing : ");
String str =br.readLine();
int n1 = str.length();
String str2 = str.toUpperCase();
System.out.println("---toUpperCase--");
System.out.println(str2);
char uc;
char[] temp = new char[n1];
System.out.println("---serialize each character with chatAt--");
for (int i =0; i < n1; i++)
{
temp[i] = str2.charAt(i);
uc = temp[i];
System.out.print(uc);
}//end for loop
}
}

 

 
 

import java.io.*;
import java.lang.String.*;
//javac for_each_euivalent_4.java
class for_each_euivalent_4{
public static void main(String arguments[])throws IOException

{
InputStreamReader isr = new InputStreamReader(System.in);
BufferedReader br = new BufferedReader(isr);
//needs throws IOException
System.out.print("Type some thing : ");
String str =br.readLine();
String[] words = str.split (" ");
String strempty = "";
int n1 = words.length;
System.out.println ("No of words are : " +n1);
String str_uc= "";
System.out.println("--for loop: ");
char uc;
int x =0;
for (String search:words)
{
System.out.println ("\t round "+ x + " word :" +search);
x++;
}//end for loop

}
}