Simple Java Hangman Assignment

后端 未结 5 1981
夕颜
夕颜 2021-02-06 06:05

I\'m stuck on a java assignment for a class where we need to make a Hangman game but a REALLY BASIC one (It\'s an intro to Java class). Basically I have a word entered by someon

5条回答
  •  深忆病人
    2021-02-06 06:19

    How to create HangMan Game

    package arr_game;

    import java.util.Random;
    import java.util.Scanner;
    public class HangMan3 {
        public static char[] star;
            public static void main (String args[])
            {   
                char game[];
                Scanner input = new Scanner(System.in);
                Random r = new Random();
                String[] arr = { "pakistan", "india", "jarmany", "america", "rashia", "iran", "iraq", "japan", "sudan", "canada"};
    
                String word = arr[r.nextInt(arr.length)];
                int count = word.length();
                char[] CharArr=word.toCharArray(); 
                char[] star = word.toCharArray();
            for(int i=0;i

提交回复
热议问题