Recently I made simple hangman game in Java.Main.javapackage com.company;import java.util.Arrays;import java.util.Scanner;public class Main {    public static void main(String[] args) {        Scanner input = new Scanner(System.in);        System.out.println(Type a passwords);        String word = input.nextLine();        char[] password = word.toCharArray();        char[] passwordView = new char[password.length];        for (int w = 0; w < passwordView.length; w++) {            passwordView[w] = '_';        }        int badAnswers = 0;        char letter = 'x';        String guess;        boolean success;        String answers = ;        while (badAnswers < 11) {            success = false;            System.out.println(Type a char.);            while (!success) {                guess = input.nextLine();                if (guess.length() == 1 && !(answers.contains(guess))) {                    letter = guess.charAt(0);                    success = true;                    answers = answers + letter + , ;                } else if (!(guess.length() == 1)){                    System.out.println(Type exactly one char!);                }                else if (answers.contains(guess)){                    System.out.println(You have already typed that symbol!);                }            }            CheckingIfPasswordContainsLetter checker = new CheckingIfPasswordContainsLetter();            if (checker.cointans(password, letter)) {                for (int i = 0; i < password.length; i++) {                    if (password[i] == letter) {                        passwordView[i] = letter;                    }                }            } else {                badAnswers++;                System.out.println(Bad);            }            if (!(Arrays.equals(password, passwordView))) {                System.out.println(Already used symbols:  + answers);                System.out.print(Current password is );                new PrintingArray(passwordView);                System.out.print(\n);            }            if (Arrays.equals(password, passwordView)) {                System.out.print(You won! the password was );                new PrintingArray(password);                break;            }            if (badAnswers == 11) {                System.out.print(You lose! Sorry!);                break;            }        }    }}PrintingArray.javapackage com.company;public class PrintingArray {    public PrintingArray(char[] a){        for (char z : a) {            System.out.print(z);        }    }}CheckingIfPasswordContainsLetter.javapackage com.company;public class CheckingIfPasswordContainsLetter {    public boolean cointans(char[] a, char b) {        for (int i = 0; i < a.length; i++) {            if (a[i] == b) {                return true;            }        }        return false;    }}
Simple game - hangman
java;beginner;hangman