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 8814651
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T04:10:55+00:00 2026-06-14T04:10:55+00:00

I try to make a multidimensional array with methods. But i stuck in here;

  • 0

I try to make a multidimensional array with methods. But i stuck in here; my print method not working properly. It shows nothing and no errors.

public void bas() { // ========> print method
for (int a = 0; a < dizi.length; a++) {
    for (int b = 0; b < dizi[a].length; b++) {
        System.out.println(" dizi[" + n + "][" + m + "] = "
        + dizi[n][m]);
    }}}

it fixed.

public int[][] doldur() { // ========> fill method
for (int i = 0; i < dizi.length; i++) {
    for (int j = 0; j < dizi.length[i]; j++) { //problem in here: The type of the expression must be an array type but it resolved to int

    }
}
return dizi;

}

dizi.length[i] => dizi[i].length


rest of my code:

public class ikiBoyutluDizi {
int n, m;
int[][] dizi = new int[n][m];

public int[][] diziBoyutu(int a, int b) {
    return dizi;
}

public int[][] doldur() { // ========> fill method
    for (int i = 0; i < dizi.length; i++) {
        for (int j = 0; j < dizi.length[i]; j++) {

        }
    }
    return dizi;
}

public void bas() { // ========> print method
    for (int a = 0; a < dizi.length; a++) {

        for (int b = 0; b < dizi[a].length; b++) {

            System.out.println(" dizi[" + n + "][" + m + "] = "

            + dizi[n][m]);

        }
    }
}

public static void main(String[] args) {
    ikiBoyutluDizi dizi2x = new ikiBoyutluDizi();
    dizi2x.diziBoyutu(2, 3);
    dizi2x.doldur();
    dizi2x.bas();
}

}

One more thing; can you check my print method? Do you think is it working properly after fix the fill method?

  • 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-06-14T04:10:57+00:00Added an answer on June 14, 2026 at 4:10 am

    In the problematic line – you should use dizi[i].length instead of dizi.length[i].

    The reason is dizi is of type int[][] and thus dizi[i] is of type int[] – which is an array, but dizi.length is an int, and you actually tried to access an element in an int – which is impossible!

    You might also want to make sure dizi[i] != null before doing so

    public int[][] doldur() { // ========> fill method
    for (int i = 0; i < dizi.length; i++) {
        for (int j = 0; dizi[i] != null && j < dizi[i].length; j++) { 
          //               ^                         ^
          //           not null                   dizi[i].length 
          //                                         instead of
          //                                      dizi.length[i]
          // Do domething
    
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I try to make some databinding involving an x:Array defined in the resources, but
I try to make an animation with an image in my view but it
I try to make Ext.Data.Store working... With a normal proxy it works great: var
I try to make a useful macro for logging. But I find that NSLog
I try to make my code fool-proof, but I've noticed that it takes a
i'm trying to make a while in my multidimensional array like this: $address =
I try to make a slider but have trouble, with placing all my div
I try to make a simple test with spring/jpa/hibernate and GAE/Google Cloud SQL. But
Databinding in WPF is great, but the moment you try make things more complex
I try to make the background of my window transparent. But under widgets which

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.