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

  • Home
  • SEARCH
  • 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 6529365
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T09:37:38+00:00 2026-05-25T09:37:38+00:00

I’ve got this code public String[][] checkBoxes(String[][] varden){ ArrayList[][] tillatnaSiffror = new ArrayList[9][9]; for(int

  • 0

I’ve got this code

public String[][] checkBoxes(String[][] varden){

    ArrayList[][] tillatnaSiffror = new ArrayList[9][9];

    for(int i=0;i<9;i++){
        for(int ruta=0;ruta<9;ruta++){

            if(tillatnaSiffror[i][ruta] == null){
                tillatnaSiffror[i][ruta] = new ArrayList<Integer>();
                for(int add=1;add<=9;add++){
                    tillatnaSiffror[i][ruta].add(add);
                }
            }
            if(varden[i][ruta].equals("X")){
                for(int a=0;a<9;a++){
                    try {

                        System.out.println(tillatnaSiffror[i][ruta].indexOf(Integer.parseInt(varden[i][ruta])));
                        System.out.print("Testing");

                    } catch(Throwable n){
                        System.out.print("Throws exception");
                    }
                }
            }
        }
    }
}

tillatnaSiffror[i][ruta] is an ArrayList containing the numbers 1-9, and the variables i and ruta are from for loops that wrap around my code. The two-dimensional array varden contains strings with digits 1 to 9. The problem is, instead of printing the index I’m looking for, it does nothing. And it doesn’t print “Testing” afterwards either, and it’s not catched because of an exception either. I counted the amount of exceptions.

However, if I put in zero’s like this:

System.out.println(tillatnaSiffror[0][0].indexOf(Integer.parseInt(varden[0][0])));

Then it prints out the index, and also the “Testing” text. Any ideas why it doesn’t work with the variables? It’s not an ArrayIndexOutOfBounds problem; the variables are correct.

  • 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-25T09:37:39+00:00Added an answer on May 25, 2026 at 9:37 am

    Without the whole code and without knowing what exception is thrown, my only suggestion is to split that line into multiple statements and see where it pops. Then you’ll probably be able to find the answer yourself.

    String s = varden[i][ruta];
    int i = Integer.parseInt(s);
    List<Integer> l = tillatnaSiffror[i][ruta];
    int idx = l.indexOf(i);
    System.out.println(idx);
    

    Edit:

    if(varden[i][ruta].equals("X")){
    

    and then inside that if:

    Integer.parseInt(varden[i][ruta]))
    

    Do you see the problem?
    BTW, you don’t seem to use a of the third for anywhere, is that right?

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

Sidebar

Related Questions

For some reason, after submitting a string like this Jack’s Spindle from a text
I've got a string that has curly quotes in it. I'd like to replace
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
public static bool CheckLogin(string Username, string Password, bool AutoLogin) { bool LoginSuccessful; // Trim
i got an object with contents of html markup in it, for example: string
Does anyone know how can I replace this 2 symbol below from the string
I want to count how many characters a certain string has in PHP, but
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I'm new to using the Perl treebuilder module for HTML parsing and can't figure

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.