For some reason whenever i print out the code below "System.out.println("Heat 1:"); never prints but rather somehow just leaves the terminal window. because when i use print instead of println it shows but not when i use println

System.out.println("Heat 1:");
      System.out.println(heat1[0][0] +"\n"+ heat1[1][0] +"\n"+ heat1[2][0] +"\n"+ heat1[3][0] +"\n"+ heat1[4][0]+"\n");
      System.out.println("Heat 2:");
      System.out.println(heat2[0][0] +"\n"+ heat2[1][0] +"\n"+ heat2[2][0] +"\n"+ heat2[3][0] +"\n"+ heat2[4][0]+"\n");
      System.out.println("Heat 3:");
      System.out.println(heat3[0][0] +"\n"+ heat3[1][0] +"\n"+ heat3[2][0] +"\n"+ heat3[3][0] +"\n"+ heat3[4][0]+"\n");
      System.out.println("Heat 4:");
      System.out.println(heat4[0][0] +"\n"+ heat4[1][0] +"\n"+ heat4[2][0] +"\n"+ heat4[3][0] +"\n"+ heat4[4][0]+"\n");
      System.out.println("Heat 5:");
      System.out.println(heat5[0][0] +"\n"+ heat5[1][0] +"\n"+ heat5[2][0] +"\n"+ heat5[3][0] +"\n"+ heat5[4][0]+"\n");
      System.out.println("Heat 6:");
      System.out.println(heat6[0][0] +"\n"+ heat6[1][0] +"\n"+ heat6[2][0] +"\n"+ heat6[3][0] +"\n"+ heat6[4][0]+"\n");
      System.out.println("Heat 7:");
      System.out.println(heat7[0][0] +"\n"+ heat7[1][0] +"\n"+ heat7[2][0] +"\n"+ heat7[3][0] +"\n"+ heat7[4][0]);

Result:
w/ println
<---------- No "Heat 1:"
1. Gray Stallion
2. Zinc Donkey
3. Yellow Stallion
4. Green Stallion
5. Old Stallion

Heat 2:
1. Purple Donkey
2. Wood Stallion
3. Gray Donkey
4. Marigold Stallion
5. Young Donkey

--------------------------------

w/ print
Heat 1:1. Gray Stallion
2. Zinc Donkey
3. Yellow Stallion
4. Green Stallion
5. Old Stallion

Heat 2:
1. Purple Donkey
2. Wood Stallion
3. Gray Donkey
4. Marigold Stallion
5. Young Donkey

Member Avatar for timmy568

I assume you are printing this in main, correct?

I assume you are printing this in main, correct?

yes correct

I see no reason as why
System.out.println("heat");
would terminate your screen.

can you show your entire code?

also, why are you using two dimensional arrays if you're only using the first element?
a default array would be sufficient.

I agree with stultuske, is this your entire code? please post it, because if the array is declared correctly(although 2d not needed-if thats your full code and array), your first line should print regardless of println() or print() the difference would be your 'Heat 2:' would be on the same line as 'Heat 1:' if print() was used in place of println()

public class Horses
{
    public static void main(String args[])
    {
      String[][] horses = {{"Black ","White ","Gray ","Old ","Young ",
                             "Pink ","Yellow ","Brown ","Orange ","Cyan ", 
                             "Purple ","Tan ","Cerulean ","Silver ","Gold ", 
                             "Red ","Green ","Blue ","Maroon ","Marigold ", 
                             "Iron ","Paper ","Wood ","Zinc ","Metal "},
                             {"Stallion", "Donkey"}
                           };
                         
      String[][] horsePlace = {{pickRand.get(horses[0]), pickRand.get(horses[0]), pickRand.get(horses[0])
                              , pickRand.get(horses[0]), pickRand.get(horses[0]), pickRand.get(horses[0])},
                              {pickRand.get(horses[1]), pickRand.get(horses[1]), pickRand.get(horses[1]),
                               pickRand.get(horses[1]), pickRand.get(horses[1])}};
                               
      String[][] horsePlace2 = {{pickRand.get(horses[0]), pickRand.get(horses[0]), pickRand.get(horses[0])
                              , pickRand.get(horses[0]), pickRand.get(horses[0]), pickRand.get(horses[0])},
                              {pickRand.get(horses[1]), pickRand.get(horses[1]), pickRand.get(horses[1]),
                               pickRand.get(horses[1]), pickRand.get(horses[1])}}; 
                               
      String[][] horsePlace3 = {{pickRand.get(horses[0]), pickRand.get(horses[0]), pickRand.get(horses[0])
                              , pickRand.get(horses[0]), pickRand.get(horses[0]), pickRand.get(horses[0])},
                              {pickRand.get(horses[1]), pickRand.get(horses[1]), pickRand.get(horses[1]),
                               pickRand.get(horses[1]), pickRand.get(horses[1])}};     
                               
      String[][] horsePlace4 = {{pickRand.get(horses[0]), pickRand.get(horses[0]), pickRand.get(horses[0])
                              , pickRand.get(horses[0]), pickRand.get(horses[0]), pickRand.get(horses[0])},
                              {pickRand.get(horses[1]), pickRand.get(horses[1]), pickRand.get(horses[1]),
                               pickRand.get(horses[1]), pickRand.get(horses[1])}};     
                               
      String[][] horsePlace5 = {{pickRand.get(horses[0]), pickRand.get(horses[0]), pickRand.get(horses[0])
                              , pickRand.get(horses[0]), pickRand.get(horses[0]), pickRand.get(horses[0])},
                              {pickRand.get(horses[1]), pickRand.get(horses[1]), pickRand.get(horses[1]),
                               pickRand.get(horses[1]), pickRand.get(horses[1])}};     
     

      
      String[][] Placement = {{"1. "},
                           {"2. "},
                           {"3. "},
                           {"4. "},
                           {"5. "}};
      
      String[][] heat1 = {{Placement[0][0] + horsePlace[0][0] + horsePlace[1][0]},
                         {Placement[1][0] + horsePlace[0][1] + horsePlace[1][1]},
                         {Placement[2][0] + horsePlace[0][2] + horsePlace[1][2]},
                         {Placement[3][0] + horsePlace[0][3] + horsePlace[1][3]},
                         {Placement[4][0] + horsePlace[0][4] + horsePlace[1][4]}};
      
      
      String[][] heat2 = {{Placement[0][0] + horsePlace2[0][0] + horsePlace2[1][0]},
                         {Placement[1][0] + horsePlace2[0][1] + horsePlace2[1][1]},
                         {Placement[2][0] + horsePlace2[0][2] + horsePlace2[1][2]},
                         {Placement[3][0] + horsePlace2[0][3] + horsePlace2[1][3]},
                         {Placement[4][0] + horsePlace2[0][4] + horsePlace2[1][4]}};
                         
      String[][] heat3 = {{Placement[0][0] + horsePlace3[0][0] + horsePlace3[1][0]},
                         {Placement[1][0] + horsePlace3[0][1] + horsePlace3[1][1]},
                         {Placement[2][0] + horsePlace3[0][2] + horsePlace3[1][2]},
                         {Placement[3][0] + horsePlace3[0][3] + horsePlace3[1][3]},
                         {Placement[4][0] + horsePlace3[0][4] + horsePlace3[1][4]}};
                         
      String[][] heat4 = {{Placement[0][0] + horsePlace4[0][0] + horsePlace4[1][0]},
                         {Placement[1][0] + horsePlace4[0][1] + horsePlace4[1][1]},
                         {Placement[2][0] + horsePlace4[0][2] + horsePlace4[1][2]},
                         {Placement[3][0] + horsePlace4[0][3] + horsePlace4[1][3]},
                         {Placement[4][0] + horsePlace4[0][4] + horsePlace4[1][4]}};
                         
      String[][] heat5 = {{Placement[0][0] + horsePlace5[0][0] + horsePlace5[1][0]},
                         {Placement[1][0] + horsePlace5[0][1] + horsePlace5[1][1]},
                         {Placement[2][0] + horsePlace5[0][2] + horsePlace5[1][2]},
                         {Placement[3][0] + horsePlace5[0][3] + horsePlace5[1][3]},
                         {Placement[4][0] + horsePlace5[0][4] + horsePlace5[1][4]}};      
                         
      String[][] heat6 = {{Placement[0][0] + horsePlace[0][0] + horsePlace[1][0]},
                          {Placement[1][0] + horsePlace2[0][0] + horsePlace2[1][0]},
                          {Placement[2][0] + horsePlace3[0][0] + horsePlace2[1][0]},
                          {Placement[3][0] + horsePlace4[0][0] + horsePlace2[1][0]},
                          {Placement[4][0] + horsePlace5[0][0] + horsePlace2[1][0]}};

      String[][] heat7 = {{Placement[0][0] + horsePlace[0][1] + horsePlace[1][1]},
                         {Placement[1][0] + horsePlace[0][2] + horsePlace[1][2]},
                         {Placement[2][0] + horsePlace2[0][0] + horsePlace2[1][0]},
                         {Placement[3][0] + horsePlace3[0][0] + horsePlace2[1][0]},
                         {Placement[4][0] + horsePlace2[0][1] + horsePlace2[1][1]}};
                                     
      
     
    }
}

rest of code before the one posted above

public class Horses
{
    public static void main(String args[])
    {
      String[][] horses = {{"Black ","White ","Gray ","Old ","Young ",
                             "Pink ","Yellow ","Brown ","Orange ","Cyan ", 
                             "Purple ","Tan ","Cerulean ","Silver ","Gold ", 
                             "Red ","Green ","Blue ","Maroon ","Marigold ", 
                             "Iron ","Paper ","Wood ","Zinc ","Metal "},
                             {"Stallion", "Donkey"}
                           };
                         
      String[][] horsePlace = {{pickRand.get(horses[0]), pickRand.get(horses[0]), pickRand.get(horses[0])
                              , pickRand.get(horses[0]), pickRand.get(horses[0]), pickRand.get(horses[0])},
                              {pickRand.get(horses[1]), pickRand.get(horses[1]), pickRand.get(horses[1]),
                               pickRand.get(horses[1]), pickRand.get(horses[1])}};
                               
      String[][] horsePlace2 = {{pickRand.get(horses[0]), pickRand.get(horses[0]), pickRand.get(horses[0])
                              , pickRand.get(horses[0]), pickRand.get(horses[0]), pickRand.get(horses[0])},
                              {pickRand.get(horses[1]), pickRand.get(horses[1]), pickRand.get(horses[1]),
                               pickRand.get(horses[1]), pickRand.get(horses[1])}}; 
                               
      String[][] horsePlace3 = {{pickRand.get(horses[0]), pickRand.get(horses[0]), pickRand.get(horses[0])
                              , pickRand.get(horses[0]), pickRand.get(horses[0]), pickRand.get(horses[0])},
                              {pickRand.get(horses[1]), pickRand.get(horses[1]), pickRand.get(horses[1]),
                               pickRand.get(horses[1]), pickRand.get(horses[1])}};     
                               
      String[][] horsePlace4 = {{pickRand.get(horses[0]), pickRand.get(horses[0]), pickRand.get(horses[0])
                              , pickRand.get(horses[0]), pickRand.get(horses[0]), pickRand.get(horses[0])},
                              {pickRand.get(horses[1]), pickRand.get(horses[1]), pickRand.get(horses[1]),
                               pickRand.get(horses[1]), pickRand.get(horses[1])}};     
                               
      String[][] horsePlace5 = {{pickRand.get(horses[0]), pickRand.get(horses[0]), pickRand.get(horses[0])
                              , pickRand.get(horses[0]), pickRand.get(horses[0]), pickRand.get(horses[0])},
                              {pickRand.get(horses[1]), pickRand.get(horses[1]), pickRand.get(horses[1]),
                               pickRand.get(horses[1]), pickRand.get(horses[1])}};     
     

      
      String[][] Placement = {{"1. "},
                           {"2. "},
                           {"3. "},
                           {"4. "},
                           {"5. "}};
      
      String[][] heat1 = {{Placement[0][0] + horsePlace[0][0] + horsePlace[1][0]},
                         {Placement[1][0] + horsePlace[0][1] + horsePlace[1][1]},
                         {Placement[2][0] + horsePlace[0][2] + horsePlace[1][2]},
                         {Placement[3][0] + horsePlace[0][3] + horsePlace[1][3]},
                         {Placement[4][0] + horsePlace[0][4] + horsePlace[1][4]}};
      
      
      String[][] heat2 = {{Placement[0][0] + horsePlace2[0][0] + horsePlace2[1][0]},
                         {Placement[1][0] + horsePlace2[0][1] + horsePlace2[1][1]},
                         {Placement[2][0] + horsePlace2[0][2] + horsePlace2[1][2]},
                         {Placement[3][0] + horsePlace2[0][3] + horsePlace2[1][3]},
                         {Placement[4][0] + horsePlace2[0][4] + horsePlace2[1][4]}};
                         
      String[][] heat3 = {{Placement[0][0] + horsePlace3[0][0] + horsePlace3[1][0]},
                         {Placement[1][0] + horsePlace3[0][1] + horsePlace3[1][1]},
                         {Placement[2][0] + horsePlace3[0][2] + horsePlace3[1][2]},
                         {Placement[3][0] + horsePlace3[0][3] + horsePlace3[1][3]},
                         {Placement[4][0] + horsePlace3[0][4] + horsePlace3[1][4]}};
                         
      String[][] heat4 = {{Placement[0][0] + horsePlace4[0][0] + horsePlace4[1][0]},
                         {Placement[1][0] + horsePlace4[0][1] + horsePlace4[1][1]},
                         {Placement[2][0] + horsePlace4[0][2] + horsePlace4[1][2]},
                         {Placement[3][0] + horsePlace4[0][3] + horsePlace4[1][3]},
                         {Placement[4][0] + horsePlace4[0][4] + horsePlace4[1][4]}};
                         
      String[][] heat5 = {{Placement[0][0] + horsePlace5[0][0] + horsePlace5[1][0]},
                         {Placement[1][0] + horsePlace5[0][1] + horsePlace5[1][1]},
                         {Placement[2][0] + horsePlace5[0][2] + horsePlace5[1][2]},
                         {Placement[3][0] + horsePlace5[0][3] + horsePlace5[1][3]},
                         {Placement[4][0] + horsePlace5[0][4] + horsePlace5[1][4]}};      
                         
      String[][] heat6 = {{Placement[0][0] + horsePlace[0][0] + horsePlace[1][0]},
                          {Placement[1][0] + horsePlace2[0][0] + horsePlace2[1][0]},
                          {Placement[2][0] + horsePlace3[0][0] + horsePlace2[1][0]},
                          {Placement[3][0] + horsePlace4[0][0] + horsePlace2[1][0]},
                          {Placement[4][0] + horsePlace5[0][0] + horsePlace2[1][0]}};

      String[][] heat7 = {{Placement[0][0] + horsePlace[0][1] + horsePlace[1][1]},
                         {Placement[1][0] + horsePlace[0][2] + horsePlace[1][2]},
                         {Placement[2][0] + horsePlace2[0][0] + horsePlace2[1][0]},
                         {Placement[3][0] + horsePlace3[0][0] + horsePlace2[1][0]},
                         {Placement[4][0] + horsePlace2[0][1] + horsePlace2[1][1]}};
                                     
      
     
    }
}

rest of code before the one posted above

could you please post the pickRand method too? so i can check it myself on my netbeans

import java.util.Random;
class pickRand {
    public static String get (String[] array) {
        Random generator = new Random();
        int rnd = generator.nextInt(array.length);
        return array[rnd];
    }
}

I just tried it. as I assumed, it works just fine with println

I just tried it. as I assumed, it works just fine with println

same here.
this is my output:

run:
Heat 1:
1. Cerulean Donkey
2. Maroon Donkey
3. Silver Donkey
4. Marigold Donkey
5. Metal Donkey

Heat 2:
1. Metal Donkey
2. Zinc Donkey
3. Cerulean Stallion
4. Marigold Stallion
5. Paper Stallion

Heat 3:
1. Cyan Donkey
2. Iron Stallion
3. Maroon Stallion
4. Blue Stallion
5. Silver Stallion

Heat 4:
1. Silver Donkey
2. Green Donkey
3. Maroon Donkey
4. Metal Stallion
5. Silver Stallion

Heat 5:
1. Cerulean Donkey
2. Red Stallion
3. Marigold Stallion
4. Iron Donkey
5. Old Donkey

Heat 6:
1. Cerulean Donkey
2. Metal Donkey
3. Cyan Donkey
4. Silver Donkey
5. Cerulean Donkey

Heat 7:
1. Maroon Donkey
2. Silver Donkey
3. Metal Donkey
4. Cyan Donkey
5. Zinc Donkey
BUILD SUCCESSFUL (total time: 1 second)

im using a compiler called bluej and its as if a specific section in the sandbox is like the void. whatever u pt in like between lines 20-25 wont give an output must be a bug but thx anyways :)

or you have an if (or something similar) that keeps it from printing.
can you show us your entire code in one piece?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.