import java.lang.Math;
import java.lang.String;
class Main {
public static String [] list = {};
public static void main(String[] args)
{
String[] list = {"every", " near ing ", " checking", "food ", "stand", "value s"};
System.out.println("\nNew Array List.");
System.out.print("{");
for(int i = 0; i < list.length; i++)
{
for (int x = 0; x < list[i].length(); x++)
{
//Condition if char is not a space-------------------------
if(list[i].charAt(x) != ' ')
{
System.out.print(list[i].charAt(x));
}
}
//Condition for comma---------------------------------------
if ( i < list.length-1)
{
System.out.print(", ");
}
}
System.out.println("}");
}
}
No comments:
Post a Comment