DEV Community

Cover image for Making battleship in java
phranxnen
phranxnen

Posted on

Making battleship in java

public class Battleship {
static void Board(){
String[][]fieldSize={
{"~~~~~"},
{"
~~~~~"},
{"~~~~~"},
{"
~~~~~"},
{"~~~~~"},
{"
~~~~~"},
{"~~~~~"},
{"
~~~~~"},
{"~~~~~"},
{"
~~~~~"}

};
for(int i=0;i<fieldSize.length;i++){
  for(int j=0;j<fieldSize[i].length;j++){
     System.out.print(fieldSize[i][j]+" ");
  }
  System.out.println();
}
 }
public static void main(String[] args) {
    Board();
}
Enter fullscreen mode Exit fullscreen mode

}

Top comments (0)