{"id":94646,"date":"2023-07-10T11:37:10","date_gmt":"2023-07-10T06:07:10","guid":{"rendered":"https:\/\/firstcode.school\/?p=94646"},"modified":"2023-07-13T16:46:36","modified_gmt":"2023-07-13T11:16:36","slug":"java-memory-game","status":"publish","type":"post","link":"https:\/\/firstcode.school\/java-memory-game\/","title":{"rendered":"Java Memory Game &#8211;  Put Your Mind to the Test"},"content":{"rendered":"<div class='__iawmlf-post-loop-links' style='display:none;' data-iawmlf-post-links='[]'><\/div>\n<p>In this project, we will create a Memory Game using Java Swing. The Memory Game is a popular game where players need to match pairs of identical cards by flipping them over. Our Memory Game will have a graphical user interface (GUI) implemented using Java Swing components. The game will consist of multiple levels and different difficulty modes.<\/p>\n<h3>About Java Memory Game App<\/h3>\n<p>The objective of this project is to guide learners in creating a Memory Game using Java&#8217;s Swing library. By following the project, learners will gain hands-on experience in setting up the game window, handling user interactions, implementing game logic for comparing and matching cards, and displaying the final score.<\/p>\n<h3>Prerequisites for Memory Game App using Java<\/h3>\n<p>To successfully follow along with this project, you should have a basic understanding of Java programming and object-oriented concepts. It is also important to have the Java Development Kit (JDK) installed on your machine for code compilation and execution.<\/p>\n<p>Additionally, a working knowledge of Java Swing, a framework for creating GUIs, is required to comprehend and work with the graphical components used in this project. While any Integrated Development Environment (IDE) can be used, this tutorial utilizes Eclipse as the IDE of choice.<\/p>\n<h3>Download Java Memory game App Project<\/h3>\n<p>Please download the source code of Java Memory game App Project: <a href=\"https:\/\/s3.ap-south-1.amazonaws.com\/firstcode.school\/java-projects\/memory-game.zip\"><strong>Java<\/strong> <strong>Memory game App Project Code<\/strong><\/a><\/p>\n<h3>Steps to Create Memory Game App Project using Java<\/h3>\n<p><strong>Step 1:<\/strong>Setting up the Project in Eclipse:<\/p>\n<p><strong>Step 2:<\/strong> Implementing the code :<\/p>\n<p><strong>Step 3:<\/strong> Understanding the code we implemented:<\/p>\n<h4>Step 1:Setting up the Project in Eclipse:<\/h4>\n<p>&gt;Create a new Java project in Eclipse.<br \/>\n&gt;Right click on the project folder and create a new folder named images<br \/>\n&gt;Paste the images you want to use in the game inside the folder, or you can use the images provided with the source code of this project<br \/>\nThe project structure should look something like this:<\/p>\n<p><a href=\"https:\/\/firstcode.school\/wp-content\/uploads\/2023\/07\/project-structure.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-94655 size-full\" src=\"https:\/\/firstcode.school\/wp-content\/uploads\/2023\/07\/project-structure.webp\" alt=\"project structure\" width=\"278\" height=\"579\" \/><\/a><\/p>\n<p>The images with numbers as their name are different colors which we will use in the Hard difficulty mode, and the rest of the images will be used in the Easy difficulty mode.<\/p>\n<h4>Step 2: Implementing the code :<\/h4>\n<p>Here is the complete code for the MemoryGame.java:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">package school.FirstCode;\r\n\r\nimport java.awt.EventQueue;\r\n\r\nimport javax.swing.JFrame;\r\nimport javax.swing.JPanel;\r\n\r\nimport java.awt.Color;\r\nimport java.awt.Dimension;\r\nimport java.awt.GridLayout;\r\nimport javax.swing.JLabel;\r\nimport javax.swing.JButton;\r\nimport java.awt.event.ActionListener;\r\nimport java.util.Arrays;\r\nimport java.util.Collections;\r\nimport java.util.Iterator;\r\nimport java.util.List;\r\nimport java.awt.event.ActionEvent;\r\nimport javax.swing.JTextArea;\r\nimport javax.swing.Timer;\r\nimport javax.swing.border.LineBorder;\r\nimport javax.swing.BoxLayout;\r\nimport javax.swing.ImageIcon;\r\n\r\n@SuppressWarnings(\"serial\")\r\npublic class MemoryGame extends JFrame implements ActionListener{\r\n\r\n    private JPanel gamePanel;\r\n    private JPanel winPanel;\r\n    private String[] easyLvl = {\"images\/bear.png\",\r\n                                \"images\/cat.png\",\r\n                                \"images\/cow.png\",\r\n                                \"images\/dog.png\",\r\n                                \"images\/giraffe.png\",\r\n                                \"images\/hippo.png\",\r\n                                \"images\/horse.png\",\r\n                                \"images\/lion.png\",\r\n                                \"images\/monke.png\",\r\n                                \"images\/pig.png\",\r\n                                \"images\/bear.png\",\r\n                                \"images\/cat.png\",\r\n                                \"images\/cow.png\",\r\n                                \"images\/dog.png\",\r\n                                \"images\/giraffe.png\",\r\n                                \"images\/hippo.png\",\r\n                                \"images\/horse.png\",\r\n                                \"images\/lion.png\",\r\n                                \"images\/monke.png\",\r\n                                \"images\/pig.png\"};\r\n    \r\n    private String[] hardLvl = {\"images\/1.png\",\r\n                                \"images\/10.png\",\r\n                                \"images\/2.png\",\r\n                                \"images\/3.png\",\r\n                                \"images\/4.png\",\r\n                                \"images\/5.png\",\r\n                                \"images\/6.png\",\r\n                                \"images\/7.png\",\r\n                                \"images\/8.png\",\r\n                                \"images\/9.png\",\r\n                                \"images\/1.png\",\r\n                                \"images\/10.png\",\r\n                                \"images\/2.png\",\r\n                                \"images\/3.png\",\r\n                                \"images\/4.png\",\r\n                                \"images\/5.png\",\r\n                                \"images\/6.png\",\r\n                                \"images\/7.png\",\r\n                                \"images\/8.png\",\r\n                                \"images\/9.png\"};\r\n\r\n    private List&lt;String&gt; currentList;\r\n    private JButton[] cardButtons = new JButton[25];\r\n    private boolean firstClick = true;\r\n    private int cardOpenIdx;\r\n    private boolean cardFlipped = false;\r\n    private int score= 0;\r\n    private JPanel startPanel;\r\n    \r\n    \/**\r\n     * Launch the application.\r\n     *\/\r\n    public static void main(String[] args) {\r\n        EventQueue.invokeLater(new Runnable() {\r\n            public void run() {\r\n                try {\r\n                    MemoryGame window = new MemoryGame();\r\n                    window.setVisible(true);\r\n                } catch (Exception e) {\r\n                    e.printStackTrace();\r\n                }\r\n            }\r\n        });\r\n    }\r\n\r\n    \/**\r\n     * Create the application.\r\n     *\/\r\n    public MemoryGame() {\r\n        initialize();\r\n    }\r\n\r\n    \/**\r\n     * Initialize the contents of the frame.\r\n     *\/\r\n    private void initialize() {\r\n        setTitle(\"Memory Game by FirstCode\");\r\n        setBounds(100, 100, 450, 300);\r\n        setResizable(false);\r\n        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);\t\t\r\n        getContentPane().setLayout(new BoxLayout(getContentPane(), BoxLayout.X_AXIS));\r\n        \r\n        gamePanel = new JPanel(new GridLayout(5,5,0,0));\r\n        \r\n        startPanel = new JPanel();\r\n        getContentPane().add(startPanel);\r\n        startPanel.setLayout(null);\r\n        \r\n        JLabel lblSelectDifficulty = new JLabel(\"Select Difficulty:\");\r\n        lblSelectDifficulty.setBounds(12, 225, 120, 15);\r\n        startPanel.add(lblSelectDifficulty);\r\n        \r\n        JTextArea txtrInstructions = new JTextArea();\r\n        txtrInstructions.setEditable(false);\r\n        txtrInstructions.setWrapStyleWord(true);\r\n        txtrInstructions.setText(\"In this game you have to match the pair of cards with same images.\\n For every correct match you get 1 Point and for every wrong match you get -1 point\\n\\nThere are two difficulty levels Easy and Hard.In easy mode you have to match animal images and in hard mode you have to match different color shades \\n\\nTo Start the game select a difficulty level form below:\");\r\n        txtrInstructions.setLineWrap(true);\r\n        txtrInstructions.setBounds(20, 0, 400, 200);\r\n        startPanel.add(txtrInstructions);\r\n        \r\n        JButton btnEasy = new JButton(\"Easy\");\r\n        btnEasy.addActionListener(new ActionListener() {\r\n            public void actionPerformed(ActionEvent e) {\r\n                remove(startPanel);\r\n                setSize(new Dimension(750,800));\r\n                getContentPane().add(gamePanel);\r\n                setLevel(easyLvl);\r\n                revalidate();\r\n                repaint();\r\n            }\r\n        });\r\n        btnEasy.setBounds(150, 220, 117, 25);\r\n        startPanel.add(btnEasy);\r\n        \r\n        JButton btnHard = new JButton(\"Hard\");\r\n        btnHard.addActionListener(new ActionListener() {\r\n            public void actionPerformed(ActionEvent e) {\r\n                remove(startPanel);\r\n                setSize(new Dimension(750,800));\r\n                getContentPane().add(gamePanel);\r\n                setLevel(hardLvl);\r\n                revalidate();\r\n                repaint();\r\n            }\r\n        });\r\n        btnHard.setBounds(279, 220, 117, 25);\r\n        startPanel.add(btnHard);\r\n\r\n        \r\n        \r\n    }\r\n    \r\n\/\/\tMethod to set the level and initialize the game variables\r\n    private void setLevel(String[] icons) {\r\n        score = 0;\r\n        currentList = Arrays.asList(icons);\r\n        Collections.shuffle(currentList);\/\/shuffling the list to randomize the image positions\r\n        for(int i = 0;i&lt;20;i++){\r\n            cardButtons[i] = new JButton();\r\n            cardButtons[i].addActionListener(this);\r\n            cardButtons[i].setIcon(new ImageIcon(currentList.get(i)));\r\n            cardButtons[i].setBorder(new LineBorder(Color.black));\r\n            cardButtons[i].setContentAreaFilled(false);;\t\t\t\r\n            gamePanel.add(cardButtons[i]);\r\n        }\r\n    }\r\n    \r\n\/\/\tmethod to hide all the cards from the user\r\n    private void hideAll() {\r\n        for(int i = 0;i&lt;20;i++){\r\n            cardButtons[i].setIcon(null);\r\n        }\r\n    }\r\n    \r\n\/\/\tMethod to hide a card from the user \r\n    private void hideCard(int i) {\r\n            cardButtons[i].setIcon(null);\r\n    }\r\n    \r\n\/\/\tMethod to check if all the elements in the list are matched\r\n    private boolean checkWin() {\r\n        String firstElement = currentList.iterator().next();  \/\/ Get the first element\r\n        \r\n        for (String element : currentList) {\r\n            if (!element.equals(firstElement)) {\r\n                return false;  \/\/ Element is different from the first element\r\n            }\r\n        }\r\n        \r\n        return true;  \/\/ All elements are the same\r\n\r\n    }\r\n    \r\n\/\/\tMethod to add the winnig screen and show the score and playAgain option\r\n    private void winScreen() {\r\n        remove(gamePanel);\r\n        winPanel = new JPanel(new GridLayout(0,1));\r\n        String winString = \"You Lost!!Your score was \"+score;\r\n        if(score&gt;0) {winString = \"You Win!!Your score was \"+score;}\r\n        winPanel.add(new JLabel(winString));\r\n        JButton playAgain = new JButton(\"Play Again\");\r\n        playAgain.addActionListener(new ActionListener() {\r\n            \r\n            @Override\r\n            public void actionPerformed(ActionEvent e) {\r\n                remove(winPanel);\r\n                getContentPane().add(startPanel);\r\n                revalidate();\r\n                repaint();\r\n            }\r\n        });\r\n        winPanel.add(playAgain);\r\n        setSize(new Dimension(450,300));\r\n        getContentPane().add(winPanel);\r\n        revalidate();\r\n        repaint();\r\n    }\r\n    \r\n\/\/\tImplementing the actionPerformed method to handle multiple button clicks\r\n    @Override\r\n    public void actionPerformed(ActionEvent e) {\r\n        if (firstClick) {\r\n            hideAll();\r\n            firstClick = false;\r\n            return;\r\n        }\r\n\r\n\/\/Handling the clicks and checking if the cards match or not for every button\r\n        for (int i = 0; i &lt; cardButtons.length; i++) {\r\n            if (e.getSource() == cardButtons[i] &amp;&amp; currentList.get(i) != \"matched\") {\r\n                cardButtons[i].setIcon(new ImageIcon(currentList.get(i)));\r\n\r\n                if (cardFlipped) {\r\n                    if (currentList.get(cardOpenIdx) == currentList.get(i) &amp;&amp; i != cardOpenIdx) {\r\n                        currentList.set(i, \"matched\");\r\n                        currentList.set(cardOpenIdx, \"matched\");\r\n                        cardFlipped = false;\r\n                        score++;\r\n                    } else {\r\n                    \tscore--;\r\n                        cardFlipped = false;\r\n\r\n                        final int secondCardIndex = i; \/\/ Create a final copy of i\r\n\r\n                        Timer timer = new Timer(150, new ActionListener() {\r\n                            @Override\r\n                            public void actionPerformed(ActionEvent e) {\r\n                                hideCard(cardOpenIdx);\r\n                                hideCard(secondCardIndex); \/\/ Use the final copy of i\r\n                            }\r\n                        });\r\n                        timer.setRepeats(false);\r\n                        timer.start();\r\n                    }\r\n                } else {\r\n                    cardOpenIdx = i;\r\n                    cardFlipped = true;\r\n                }\r\n            }\r\n            \r\n           \r\n        }\r\n         if(checkWin()) {\r\n            \twinScreen();\r\n            }\r\n        \r\n    }\r\n\r\n}<\/pre>\n<h4>Step 3:Understanding the code we implemented:<\/h4>\n<p>The code implements a Memory Game using Java&#8217;s Swing library for creating a graphical user interface (GUI). The game consists of a grid of cards that the player needs to match.<\/p>\n<p>When the program is executed, the main method is called, which creates an instance of the MemoryGame class and makes the game window visible.<\/p>\n<p>The MemoryGame class extends JFrame and acts as the main window for the game. It contains methods for initializing the game, setting the difficulty level, handling card clicks, and displaying the win\/lose screen.<\/p>\n<p>The initialize method sets up the initial UI components, including a start panel with instructions and buttons for selecting the difficulty level. The setLevel method is called when the player selects a difficulty level. It shuffles the card icons, creates buttons for each card, assigns the shuffled icons to the buttons, and adds them to the game panel.<\/p>\n<p>The actionPerformed method handles button clicks. It determines which card button was clicked and compares the icons on the cards. If the icons match, the cards remain face-up, and the score is incremented. If the icons do not match, the cards are briefly shown to the player before being hidden again, and the score is decremented.<\/p>\n<p>The checkWin method is called after each move to check if all the cards have been matched. If all the cards are matched, the winScreen method is called, which removes the game panel and displays a win\/lose screen with the final score and an option to play again.<\/p>\n<p><strong>Here&#8217;s an explanation of the functions in the code:<\/strong><\/p>\n<p><strong>1. &#8220;MemoryGame()&#8221;<\/strong> &#8211; The constructor method for the &#8220;MemoryGame&#8221; class. It calls the &#8220;initialize()&#8221; method to set up the game.<\/p>\n<p><strong>2. &#8220;initialize()&#8221; &#8211;<\/strong> Initializes the JFrame window and sets up the initial UI components. It creates a start panel with instructions and buttons for selecting the difficulty level.<\/p>\n<p><strong>3. &#8220;setLevel(String[] icons)&#8221; &#8211;<\/strong> Sets the game level and initializes the game variables. It takes an array of icons representing the cards for the selected level. The method shuffles the icons, creates JButton instances for each card, assigns the icons to the buttons, and adds them to the game panel.<\/p>\n<p><strong>4. &#8220;hideAll()&#8221; &#8211;<\/strong> Hides all the cards by removing the icons from the buttons. It is called when the game starts or when the player makes an incorrect match.<\/p>\n<p><strong>5. &#8220;hideCard(int i)&#8221; &#8211;<\/strong> Hides a specific card identified by its index. It removes the icon from the button.<\/p>\n<p><strong>6. &#8220;checkWin()&#8221; &#8211;<\/strong> Checks if all the cards have been matched. It compares the first element in the &#8220;currentList&#8221; (shuffled list of icons) with every other element. If any element is different, the method returns false, indicating that not all cards are matched. If all elements are the same, it returns true, indicating that the player has won.<\/p>\n<p><strong>7. &#8220;winScreen()&#8221; &#8211;<\/strong> Adds a winning screen to the frame when the game is won or lost. It removes the game panel and creates a winning panel with a label showing the score and a &#8220;Play Again&#8221; button. Clicking the button returns the player to the start panel.<\/p>\n<p><strong>8. &#8220;actionPerformed(ActionEvent e)&#8221; &#8211;<\/strong> Handles the button clicks in the game. It is implemented from the &#8220;ActionListener&#8221; interface. This method is called when a button is clicked. It performs different actions based on the game&#8217;s logic. Initially, it hides all the cards when the first button is clicked. After that, it checks which button was clicked and compares the icons on the cards. If the icons match, the cards remain face-up, and the score is incremented. If the icons do not match, the cards are hidden after a brief delay, and the score is decremented. The method also checks if the game has been won after each move.<\/p>\n<p><strong>9. &#8220;main(String[] args)&#8221; &#8211;<\/strong> The entry point of the program. It creates an instance of &#8220;MemoryGame&#8221; and makes it visible.<\/p>\n<h3>Java Memory Game Output<\/h3>\n<p><a href=\"https:\/\/firstcode.school\/wp-content\/uploads\/2023\/07\/java-memory-game-output.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-94656 size-full\" src=\"https:\/\/firstcode.school\/wp-content\/uploads\/2023\/07\/java-memory-game-output.webp\" alt=\"java memory game output\" width=\"452\" height=\"302\" \/><\/a><\/p>\n<h3><a href=\"https:\/\/firstcode.school\/wp-content\/uploads\/2023\/07\/memory-game-output.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-94657 size-full\" src=\"https:\/\/firstcode.school\/wp-content\/uploads\/2023\/07\/memory-game-output.webp\" alt=\"memory game output\" width=\"752\" height=\"802\" \/><\/a><\/h3>\n<h3><a href=\"https:\/\/firstcode.school\/wp-content\/uploads\/2023\/07\/memory-game-project-output.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-94658 size-full\" src=\"https:\/\/firstcode.school\/wp-content\/uploads\/2023\/07\/memory-game-project-output.webp\" alt=\"memory game project output\" width=\"752\" height=\"802\" \/><\/a><\/h3>\n<h3><a href=\"https:\/\/firstcode.school\/wp-content\/uploads\/2023\/07\/java-memory-game-project-output.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-94659 size-full\" src=\"https:\/\/firstcode.school\/wp-content\/uploads\/2023\/07\/java-memory-game-project-output.webp\" alt=\"java memory game project output\" width=\"452\" height=\"302\" \/><\/a><\/h3>\n<h3>Summary:<\/h3>\n<p>In this project, we learned how to create a Memory Game using Java&#8217;s Swing library. We started by setting up the game window and creating panels for the UI components. We then initialized the game with different difficulty levels, shuffling and assigning icons to the card buttons.<\/p>\n<p>We learned how to handle user interactions by implementing logic for comparing clicked cards and updating the score accordingly. We also implemented functionality to flip the cards back if they don&#8217;t match. We explored how to check for a win condition by verifying if all the cards had been matched.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this project, we will create a Memory Game using Java Swing. The Memory Game is a popular game where players need to match pairs of identical cards by flipping them over. Our Memory&#46;&#46;&#46;<\/p>\n","protected":false},"author":1,"featured_media":94654,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3476],"tags":[3692,3691,3652,3653,3674,3694,3693],"class_list":["post-94646","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-java-tutorials","tag-java-memory-game","tag-java-memory-game-project","tag-java-project-for-practice","tag-java-project-ideas","tag-java-projects","tag-memory-game","tag-memory-game-project"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.0 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Java Memory Game - Put Your Mind to the Test - First Code School<\/title>\n<meta name=\"description\" content=\"Challenge your memory with our captivating Java Memory Game. Test your skills and have fun while sharpening your mind. Play now!\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/firstcode.school\/java-memory-game\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Java Memory Game - Put Your Mind to the Test - First Code School\" \/>\n<meta property=\"og:description\" content=\"Challenge your memory with our captivating Java Memory Game. Test your skills and have fun while sharpening your mind. Play now!\" \/>\n<meta property=\"og:url\" content=\"https:\/\/firstcode.school\/java-memory-game\/\" \/>\n<meta property=\"og:site_name\" content=\"First Code School\" \/>\n<meta property=\"article:published_time\" content=\"2023-07-10T06:07:10+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-07-13T11:16:36+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/firstcode.school\/wp-content\/uploads\/2023\/07\/java-memory-game.webp\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"628\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/webp\" \/>\n<meta name=\"author\" content=\"FCsBDAd\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"FCsBDAd\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"9 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/firstcode.school\/java-memory-game\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/firstcode.school\/java-memory-game\/\"},\"author\":{\"name\":\"FCsBDAd\",\"@id\":\"https:\/\/firstcode.school\/#\/schema\/person\/52802f2c393d41b705f359f263545918\"},\"headline\":\"Java Memory Game &#8211; Put Your Mind to the Test\",\"datePublished\":\"2023-07-10T06:07:10+00:00\",\"dateModified\":\"2023-07-13T11:16:36+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/firstcode.school\/java-memory-game\/\"},\"wordCount\":1122,\"commentCount\":0,\"image\":{\"@id\":\"https:\/\/firstcode.school\/java-memory-game\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/firstcode.school\/wp-content\/uploads\/2023\/07\/java-memory-game.webp\",\"keywords\":[\"java memory game\",\"java memory game project\",\"java project for practice\",\"java project ideas\",\"java projects\",\"memory game\",\"memory game project\"],\"articleSection\":[\"Java Tutorials\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/firstcode.school\/java-memory-game\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/firstcode.school\/java-memory-game\/\",\"url\":\"https:\/\/firstcode.school\/java-memory-game\/\",\"name\":\"Java Memory Game - Put Your Mind to the Test - First Code School\",\"isPartOf\":{\"@id\":\"https:\/\/firstcode.school\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/firstcode.school\/java-memory-game\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/firstcode.school\/java-memory-game\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/firstcode.school\/wp-content\/uploads\/2023\/07\/java-memory-game.webp\",\"datePublished\":\"2023-07-10T06:07:10+00:00\",\"dateModified\":\"2023-07-13T11:16:36+00:00\",\"author\":{\"@id\":\"https:\/\/firstcode.school\/#\/schema\/person\/52802f2c393d41b705f359f263545918\"},\"description\":\"Challenge your memory with our captivating Java Memory Game. Test your skills and have fun while sharpening your mind. Play now!\",\"breadcrumb\":{\"@id\":\"https:\/\/firstcode.school\/java-memory-game\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/firstcode.school\/java-memory-game\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/firstcode.school\/java-memory-game\/#primaryimage\",\"url\":\"https:\/\/firstcode.school\/wp-content\/uploads\/2023\/07\/java-memory-game.webp\",\"contentUrl\":\"https:\/\/firstcode.school\/wp-content\/uploads\/2023\/07\/java-memory-game.webp\",\"width\":1200,\"height\":628,\"caption\":\"java memory game\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/firstcode.school\/java-memory-game\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/firstcode.school\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Java Memory Game &#8211; Put Your Mind to the Test\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/firstcode.school\/#website\",\"url\":\"https:\/\/firstcode.school\/\",\"name\":\"First Code School\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/firstcode.school\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/firstcode.school\/#\/schema\/person\/52802f2c393d41b705f359f263545918\",\"name\":\"FCsBDAd\",\"sameAs\":[\"http:\/\/firstcode.school\"],\"url\":\"https:\/\/firstcode.school\/author\/fcsbdad\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Java Memory Game - Put Your Mind to the Test - First Code School","description":"Challenge your memory with our captivating Java Memory Game. Test your skills and have fun while sharpening your mind. Play now!","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/firstcode.school\/java-memory-game\/","og_locale":"en_US","og_type":"article","og_title":"Java Memory Game - Put Your Mind to the Test - First Code School","og_description":"Challenge your memory with our captivating Java Memory Game. Test your skills and have fun while sharpening your mind. Play now!","og_url":"https:\/\/firstcode.school\/java-memory-game\/","og_site_name":"First Code School","article_published_time":"2023-07-10T06:07:10+00:00","article_modified_time":"2023-07-13T11:16:36+00:00","og_image":[{"width":1200,"height":628,"url":"https:\/\/firstcode.school\/wp-content\/uploads\/2023\/07\/java-memory-game.webp","type":"image\/webp"}],"author":"FCsBDAd","twitter_card":"summary_large_image","twitter_misc":{"Written by":"FCsBDAd","Est. reading time":"9 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/firstcode.school\/java-memory-game\/#article","isPartOf":{"@id":"https:\/\/firstcode.school\/java-memory-game\/"},"author":{"name":"FCsBDAd","@id":"https:\/\/firstcode.school\/#\/schema\/person\/52802f2c393d41b705f359f263545918"},"headline":"Java Memory Game &#8211; Put Your Mind to the Test","datePublished":"2023-07-10T06:07:10+00:00","dateModified":"2023-07-13T11:16:36+00:00","mainEntityOfPage":{"@id":"https:\/\/firstcode.school\/java-memory-game\/"},"wordCount":1122,"commentCount":0,"image":{"@id":"https:\/\/firstcode.school\/java-memory-game\/#primaryimage"},"thumbnailUrl":"https:\/\/firstcode.school\/wp-content\/uploads\/2023\/07\/java-memory-game.webp","keywords":["java memory game","java memory game project","java project for practice","java project ideas","java projects","memory game","memory game project"],"articleSection":["Java Tutorials"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/firstcode.school\/java-memory-game\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/firstcode.school\/java-memory-game\/","url":"https:\/\/firstcode.school\/java-memory-game\/","name":"Java Memory Game - Put Your Mind to the Test - First Code School","isPartOf":{"@id":"https:\/\/firstcode.school\/#website"},"primaryImageOfPage":{"@id":"https:\/\/firstcode.school\/java-memory-game\/#primaryimage"},"image":{"@id":"https:\/\/firstcode.school\/java-memory-game\/#primaryimage"},"thumbnailUrl":"https:\/\/firstcode.school\/wp-content\/uploads\/2023\/07\/java-memory-game.webp","datePublished":"2023-07-10T06:07:10+00:00","dateModified":"2023-07-13T11:16:36+00:00","author":{"@id":"https:\/\/firstcode.school\/#\/schema\/person\/52802f2c393d41b705f359f263545918"},"description":"Challenge your memory with our captivating Java Memory Game. Test your skills and have fun while sharpening your mind. Play now!","breadcrumb":{"@id":"https:\/\/firstcode.school\/java-memory-game\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/firstcode.school\/java-memory-game\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/firstcode.school\/java-memory-game\/#primaryimage","url":"https:\/\/firstcode.school\/wp-content\/uploads\/2023\/07\/java-memory-game.webp","contentUrl":"https:\/\/firstcode.school\/wp-content\/uploads\/2023\/07\/java-memory-game.webp","width":1200,"height":628,"caption":"java memory game"},{"@type":"BreadcrumbList","@id":"https:\/\/firstcode.school\/java-memory-game\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/firstcode.school\/"},{"@type":"ListItem","position":2,"name":"Java Memory Game &#8211; Put Your Mind to the Test"}]},{"@type":"WebSite","@id":"https:\/\/firstcode.school\/#website","url":"https:\/\/firstcode.school\/","name":"First Code School","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/firstcode.school\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/firstcode.school\/#\/schema\/person\/52802f2c393d41b705f359f263545918","name":"FCsBDAd","sameAs":["http:\/\/firstcode.school"],"url":"https:\/\/firstcode.school\/author\/fcsbdad\/"}]}},"_links":{"self":[{"href":"https:\/\/firstcode.school\/wp-json\/wp\/v2\/posts\/94646","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/firstcode.school\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/firstcode.school\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/firstcode.school\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/firstcode.school\/wp-json\/wp\/v2\/comments?post=94646"}],"version-history":[{"count":7,"href":"https:\/\/firstcode.school\/wp-json\/wp\/v2\/posts\/94646\/revisions"}],"predecessor-version":[{"id":94664,"href":"https:\/\/firstcode.school\/wp-json\/wp\/v2\/posts\/94646\/revisions\/94664"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/firstcode.school\/wp-json\/wp\/v2\/media\/94654"}],"wp:attachment":[{"href":"https:\/\/firstcode.school\/wp-json\/wp\/v2\/media?parent=94646"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/firstcode.school\/wp-json\/wp\/v2\/categories?post=94646"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/firstcode.school\/wp-json\/wp\/v2\/tags?post=94646"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}