I just watched S7E25 "All Good Things ..." of Star Trek: The Next Generation which I believe is the final episode of the series. In this episode, Captain Beverly Picard tells the crew to pilot her medical ship into the Neutral Zone at Warp 13. In a separate episode of ST: Voyager (actual episode unknown to me), the characters Tom Paris and Harry Kim talk about not being able to break the Warp 10 barrier for some reason. This is toward the end of the series. Is there any explanation in the Star Trek Universe which explains this seeming difference? This especially confuses me because ST:V (1995-2001) started the year after ST:TNG ended (1987-1994). I would think it would be produced with these story lines in mind. Is there any explanation for this?


Question: Text based 2D Minesweeper
Answer: 
This solution is not very object oriented. That may be okay if you are a beginner, but if you know how to initialize objects, you should use that knowledge.
Method names should be lowercase
the Random object should be reused, make it a static member
don't write int r, c; at the beginning of the method, just initialize the vars in the loop: for(int c=...
learn to use the ternary operator, e.g. map[r][c] = (num &gt; threshold) ? 9 : 0;


And last but not least a common trick for board games: Surround your board with an invisible border of one field (e.g. your 10x10 field would become internally 12x12), which are empty. Don't show them, don't allow the user to access them. Then, if you check the neighborhood of a field for mines, you don't have to check if you are off-limits because you have that safety border, and because these fields are always empty, your count is still correct.

As a starting point, here is how I would start (without any user interaction or game loop, but with calculation and display done):

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;

public class MS2D {

    private static class Field {

        public boolean hidden = true;
        public final boolean mine;
        public int neigbors = 0;

        public Field(boolean mine) {
            this.mine = mine;
        }
    }
    private final int size;
    private Field[][] board;

    private MS2D(int size, int numberOfMines) {
        this.size = size;
        initBord(numberOfMines);
        calculateNeighbors();
        showBoard();
    }

    private void initBord(int numberOfMines) {
        List&lt;Field&gt; mines = new ArrayList&lt;Field&gt;();
        for (int i = 0; i &lt; size * size; i++) {
            mines.add(new Field(i &lt; numberOfMines));
        }
        Collections.shuffle(mines);
        board = new Field[size + 2][size + 2];
        for (int i = 0; i &lt; size + 2; i++) {
            for (int j = 0; j &lt; size + 2; j++) {
                board[i][j] = (i == 0 || j == 0 || i == size + 1 || j == size + 1)
                        ? new Field(false)
                        : mines.remove(0);
            }
        }
    }

    private void calculateNeighbors() {
        for (int i = 1; i &lt;= size; i++) {
            for (int j = 1; j &lt;= size; j++) {
                int count = 0;
                for (int di = -1; di &lt;= 1; di++) {
                    for (int dj = -1; dj &lt;= 1; dj++) {
                       if (board[i + di][j + dj].mine) count++;  
                    }
                }
                board[i][j].neigbors = count;
            }
        }
    }

    private void showBoard() {
        for(int i = 1; i &lt;= size; i++) {
            System.out.printf("%2d| ",i);
           for(int j = 1; j &lt;= size; j++) {
               Field f = board[i][j];
               if(f.hidden) {
                   System.out.print(". ");
               }  else if (f.mine) {
                   System.out.print("* ");
               } else {
                   System.out.print(f.neigbors + " ");
               }
           }          
           System.out.println();
        }
        System.out.print("    ");
        for(int i = 1; i &lt;= size; i++) {
            System.out.print(i / 10 + " ");
        }
        System.out.print("\n    ");
        for(int i = 1; i &lt;= size; i++) {
            System.out.print(i % 10 + " ");
        }
        System.out.println();
    }

    public static void main(String[] args) {
        new MS2D(15, 15);
    }
}


Note that for a real world application this approach is still not "OO" enough, as there is a tight coupling between the model and the user interface. Ideally you would factor out all user interactions in a separate class, which would simplify later refactoring (e.g. using Swing instead console). However, I felt that for that small example this would be probably overkill.