Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7628107
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T05:33:04+00:00 2026-05-31T05:33:04+00:00

Below I have a copy of my entire code for a tic tac toe

  • 0

Below I have a copy of my entire code for a tic tac toe program. I know its not much yet, but I’m stuck at the getting input part. I’ve managed to get 1 input from the user and then print it out (column), but then when I try to enter something different for row, it gives me whatever I was using for column. Any thoughts on how to fix it?

I’m just learning java, please be gentle.

import java.io.*;

public class Main {

    public static void main(String[] args) throws IOException {

        System.out.println ("Please make your first move by entering a column and then a row, like this: c r \n");

        int columnGotten = 0;
        int rowGotten = 0;

        //gets your column number choice

        BufferedReader columnInput = new BufferedReader(new InputStreamReader (System.in));

        try {
            columnGotten = Integer.parseInt(columnInput.readLine());
        } catch (NumberFormatException nfe) {
            System.out.println ("If you're not going to play fair, I'm going to leave. Bye.");
            return;         
        }

        System.out.print ("Your column is " + columnGotten + "\n");

        //gets your row number choice

        BufferedReader rowInput = new BufferedReader(new InputStreamReader (System.in));

        try {
            rowGotten = Integer.parseInt(rowInput.readLine());
        } catch (NumberFormatException nfe) {
            System.out.println ("If you're not going to play fair, I'm going to leave. Bye.");
            return;         
        }

        System.out.print ("Your row is " + columnGotten);           

    }

}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T05:33:05+00:00Added an answer on May 31, 2026 at 5:33 am

    Change

    System.out.print ("Your row is " + columnGotten);

    to

    System.out.print ("Your row is " + rowGotten);

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Note there's a lot of code posted below but its mostly all the same,
Below I have written a sample program that I have written to learn about
below i have a code that runs in most of my simple programs ..
I have below html code in my aspx. <input type=hidden id=medicalLink value='<a href=/forms/contactus.aspx >Contact
I have below code in html. <li class=selected runat=server id=lihome><a href=/ISS/home.aspx title=Home><span>Home</span></a></li> Now I
I have below is the html code for TD which gets appended after matching
Referencing the code below, I have a list of Error objects that has been
I am giving my entire code below if that helps anyway..... #import ContentViewController.h #import
Below I have a very simple example of what I'm trying to do. I
I have below a list of text, it is from a popular online game

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.