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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T19:51:09+00:00 2026-06-10T19:51:09+00:00

so how would you use that with a completely different java file but in

  • 0

so how would you use that with a completely different java file but in the same package

public static void main (int[] args)
{
int [] HotDog = {18,8,10,0};
int [] ToastedChicken = {25,8,17,0};
int [] ToastedSteak = {30,8,22,0};
int [] ToastedEggT= {20,8,6,6};
int [] ToastedSteakE={36,8,22,6};
int [] ChickenRoll = {25,8,17,0};
int [] SteakRoll = {30,8,22,0};
int [] EggTomato = {20,8,6,6};
int [] CheeseTomato = {20,8,6,6};
int [] steakEgg = {36,8,22,6};`

IE here

if (contents ==  "Hot Dog")

{jLabel2.setText(HotDog[2]); }  
  • 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-10T19:51:10+00:00Added an answer on June 10, 2026 at 7:51 pm

    You will need to make them static. For example:

    final class MyConstants {
        static final int[] HotDog = {18, 8, 10, 0};
        static final int[] ToastedChicken = {25, 8, 17, 0};
        static final int[] ToastedSteak = {30, 8, 22, 0};
        static final int[] ToastedEggT = {20, 8, 6, 6};
        static final int[] ToastedSteakE ={36, 8, 22, 6};
        static final int[] ChickenRoll = {25, 8, 17, 0};
        static final int[] SteakRoll = {30, 8, 22, 0};
        static final int[] EggTomato = {20, 8, 6, 6};
        static final int[] CheeseTomato = {20, 8, 6, 6};
        static final int[] SteakEgg = {36, 8, 22, 6};
    
        private MyConstants() {
            // Prevents users of this class from instantiating a useless instance of
            // this class, since all members are static.
        }
    }
    

    Then you can use them in any class in the same package like:

    if (contents.equals("Hot Dog")) {
        jLabel2.setText(MyConstants.HotDog[2]);
    }  
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a CSV file that I would like to use as source data
I am writing a Facebook application that would use a Postgres DB along with
I'm trying to write a function that would use its first argument, then send
Imagine you have a NB Platform application and you would like to use that
If I'm using utf-8 encoding for a character set that would use the character
How would I get the system's current language and use that for the ResourceBundle?
I am building a DLL that another application would use. I want to store
Can I use generateDS.py in python in a similar way that I would use
In Firefox, I would use the page-worker component, that allows for arbitrary many hidden
I would like to use the syntax that printf uses, using the %d, %s

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.