Quote (GrafEmpire @ Apr 16 2014 04:15pm)
the error code is just saying "1 invalid variable deceleration"
Code
public class seperating {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
int i;
String a = "12345";
String b = "";
//why are you trying to initialize a variable named 1?
//and why did you not wrap the statements underneath this for in braces? {}
for ( int 1 = 0; i < a.length(); i++)
b += a.charAt( i );
//1 + 1 eh?
if ( 1 + 1 <= a.length( ) )
b += " ";
}
}
Code
public class seperating {
public static void main(String[] args) {
String a = "12345";
String b = "";
for ( int i = 0; i < a.length(); i++)
{
b += a.charAt( i );
if ( i + 1 <= a.length( ) )
b += " ";
}
}
}