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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T18:50:54+00:00 2026-05-27T18:50:54+00:00

So every time I run the method test my String array is added to

  • 0

So every time I run the method test my String array is added to my ArrayList and it will print out the lyricLineInfo[4] value, but when the method test is ran again the array will be added on to the ArrayList but it will also replace all of the other ArrayList values with the new array. So when lyricLineInfo[4] is printed again it prints the new value instead of the old value like it’s suppose to. I’m not sure why it’s doing this can anyone help? Here is my code:

private String[] lyricLineInfo = new String[5];
private ArrayList<String[]> lyricLineNumber = new ArrayList<String[]>();

public void test() {
    lyricLineNumber.add(getInfo());
    System.out.println(lyricLineNumber.get(0)[4])
}

public String[] getInfo() {
    if (chckbxLeadSinger.isSelected()) {
        lyricLineInfo[0] = "true";
    } else {
        lyricLineInfo[0] = "false";
    }
    if (chckbxBackupSinger.isSelected()) {
        lyricLineInfo[1] = "true";
    } else {
        lyricLineInfo[1] = "false";
    }
    lyricLineInfo[2] = fieldStartTime.getText();
    lyricLineInfo[3] = fieldEndTime.getText();
    lyricLineInfo[4] = fieldLyrics.getText();
    return lyricLineInfo;
}
  • 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-27T18:50:55+00:00Added an answer on May 27, 2026 at 6:50 pm

    You’re only creating one lyricLineInfo. It shouldn’t be a field but a local variable created inside the getInfo() method.

    That is to say, remove the line

    private String[] lyricLineInfo = new String[5];
    

    and add

    String[] lyricLineInfo = new String[5];
    

    as the first line in your getInfo() method.

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

Sidebar

Related Questions

If I have an immutable string is the hashing algorithm run every time I
The app will run fine, then crash - literally every other time. It seems
I'm trying to get text from a text field but every time I run
I have this warning every time I run my CGI-script (output is rendered by
Every time I try to run a small application that uses a Derby DB
Why does every time I do mvn jetty:run, maven tries to download some dependencies
I'm using VS2008 (with windows XP). Every time I try to run a unit
I have a Visual Studio 2005 solution. Every time I try to run the
Every time I try to run any class from my rails 2.2 app's lib
Every time I start my Android instrumentation test it fails with android.test.suitebuilder.TestSuiteBuilder$FailedToCreateTests: Error in

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.