Skip to content

Instantly share code, notes, and snippets.

@jskDr
Created April 4, 2014 15:14
Show Gist options
  • Save jskDr/9976759 to your computer and use it in GitHub Desktop.
Save jskDr/9976759 to your computer and use it in GitHub Desktop.
public class String2
{
public static void main(String[] args)
{
String hw = "String of Hello world!";
String hwAll[] = {"00", "11", "22"};
String hwAll2[][] = {{"00", "zero"},{"11", "one"}, {"22", "two"}};
System.out.println( hw);
// this is used for displaying one dimensional array
for(int i=0; i<hwAll.length; i++)
{
System.out.println( hwAll[i]);
}
// it is for multidimensional method.
for(int i=0; i<hwAll2.length; i++)
{
for( int j=0; j<hwAll2[i].length; j++)
{
if( j == hwAll2[i].length - 1)
{
System.out.print(hwAll2[i][j]);
System.out.println("");
}
else
{
System.out.print(hwAll2[i][j]);
System.out.print(" : ");
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment