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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T01:37:09+00:00 2026-06-11T01:37:09+00:00

static final int[] HotDogdb = {30, 45, 44, 37,51}; static final int[] ToastedChickendb =

  • 0
        static final int[] HotDogdb = {30, 45, 44, 37,51};
    static final int[] ToastedChickendb = {25, 30, 45, 15,33};
    static final int[] ToastedSteakdb = {10, 15, 12, 16,17};
    static final int[] ToastedEggTdb = {14, 12, 17, 20,16};
    static final int[] ToastedSteakEdb ={5, 8, 3, 8,6};
    static final int[] ChickenRolldb = {27, 28, 23,20,21};
    static final int[] SteakRolldb = {19, 22, 23, 21,18};
    static final int[] EggTomatodb = {15, 16,10, 12,11};
    static final int[] CheeseTomatodb = {18, 19, 22, 21,20};
    static final int[] SteakEggdb = {10, 16, 13, 17,15};
    static final int[] tCheeseTomatodb = {23, 30, 27, 40,37};
    static final int[][] sales = new int[][] { HotDogdb, ToastedChickendb, ToastedSteakdb, ToastedEggTdb, ToastedSteakEdb,ChickenRolldb,SteakRolldb,EggTomatodb,CheeseTomatodb, SteakEggdb, tCheeseTomatodb };

So basically finding the sum of index @ 0 all the way through
what ive got so far

int total8 = 0;
int i;


for (i=0; i <= 11; i++){
total8 = total8 +  MyConstants.sales[i][0];}
                                jTextArea6.setText(""+total8);
  • 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-11T01:37:10+00:00Added an answer on June 11, 2026 at 1:37 am

    Instead of i <= 11, use i < 11:

    for (i=0; i < 11; i++) {
    

    Otherwise, you’ll get an ArrayOutOfBoundsException, since sales.length is 11, and you are using i <= 11, thus, your last iteration will try to access sales[11] which does not exist (note that arrays in Java are 0-indexed).

    Another option is to use i < sales.length. This way, if you add more elements to the array, you don’t need to change the code of your for-loop:

    for (i=0; i < sales.length; i++) {
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

public class ExampleActivity extends Activity { public static final int DIALOG_DOWNLOAD_PROGRESS = 0; private
I have a JUnit test class in which I have several static final int
Say I have a class: public class R { public static final int _1st
HashMap internally has its own static final variables for its working. static final int
So I'm declaring and initializing an int array: static final int UN = 0;
public static final int SQUARE = 0, LINE = 1, S_FIGURE = 2, Z_FIGURE
public class test { public static final int nThreads = 2; public static void
public class upload extends Activity { private static final int CAMERA_REQUEST = 1888; private
Why are Java constants declared static ? class Foo { static final int FII
public class Encryption { private static final int[] encrypt = {2, 9, 3, 4,

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.