Array
class fishLoop{
String [][] fish;
public fishLoop(){
fish = new String[][]{
// 1 fish
{
" One Fish ", //[0][0]
" _///_ ", //[0][1]
" /o |/ ", //[0][2]
" > ))_.|- ", //[0][3]
" < " //[0][4]
},
// 2 fish
{
" Two Fish ", //[1][0]
" .-=-. , ", //[1][1]
"(o >< ", //[1][2]
" `-=-' ` ", //[1][3]
" /// " //[1][4]
},
// red fish
{
" Red Fish ", //[2][0]
" . )| ", //[2][1]
" |`.-' `-oo ", //[2][2]
" ) _ __,0)", //[2][3]
" /.' )/ " //[2][4]
},
//blue fish
{
" Blue Fish ", //[3][0]
" )| ", //[3][1]
" .- -. ", //[3][2]
" )|| (( o ) ", //[3][3]
" )/'''--' " , //[3][4]
},
};
}
public void printFish(){
System.out.println();
System.out.println("~~~~~~~~~~~~~~~~~~~~~~~~~~");
System.out.println("Under the sea there are...");
int count = 4;
for (int row = 0;row < count; row++){
for (int col = 0; col < fish[row].length; col++){
System.out.print(fish[row][col] + " ");
System.out.println();
}
}
count -= 1;
}
public static void main(String[] args) {
new fishLoop().printFish();
}
}
fishLoop.main(null);
class fishLoop{
String [][] fish;
public fishLoop(){
fish = new String[][]{
// 1 fish
{
"~~~~~~~~~~~~~", //[0][0]
" _///_ ", //[0][1]
" /o |/ ", //[0][2]
" > ))_.|- ", //[0][3]
" < " //[0][4]
},
// 2 fish
{
"~~~~~~~~~~~~~", //[1][0]
" .-=-. , ", //[1][1]
"(o >< ", //[1][2]
" `-=-' ` ", //[1][3]
" /// " //[1][4]
},
// red fish
{
"~~~~~~~~~~~~~", //[2][0]
" . )| ", //[2][1]
" |`.-' `-oo ", //[2][2]
" ) _ __,0)", //[2][3]
" /.' )/ " //[2][4]
},
//blue fish
{
"~~~~~~~~~~~~~", //[3][0]
" )| ", //[3][1]
" .- -. ", //[3][2]
" )|| (( o ) ", //[3][3]
" )/'''--' " , //[3][4]
},
};
}
public void printFish(){
System.out.println();
System.out.println("Blub blub blub");
int count = fish.length;
for (int i = count; i>=1; i--){
int a = fish[0].length;
for (int row = 0; row < a; row++){
for (int col = 0; col < count; col++){
System.out.print(fish[col][row] + " ");
}
System.out.println(" ");
}
count -= 1;
}
System.out.println("Fish swimming in the sea...");
}
public static void main(String[] args) {
new fishLoop().printFish();
}
}
fishLoop.main(null);