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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T01:11:25+00:00 2026-05-27T01:11:25+00:00

I am using this to try to display all the characters in the array

  • 0

I am using this to try to display all the characters in the array but all it prints is “g”
I tested the same code using System.out.println() in regular java and it works fine

        String testarray[]={"a","s","d","f","g"};

    for(int l=0; l<testarray.length; l++){
        String temp="";
        temp=temp+testarray[l];
        display.setText(""+temp);
    }

Thanks!

  • 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-27T01:11:26+00:00Added an answer on May 27, 2026 at 1:11 am

    By your code, I will avoid what others are saying and I’ll explain to you in simple laymen terms:

    In plain english, there is a difference between set and print.

    When you set something, you replace whatever was there with a new value. When you print, you append something to whatever was there. System.out.print thus appends stuff, while setText sets stuff instead.

    The for happens so fast (computer can compute gazillion stuffs faster than you can blink) that you see a bunch of setText stuff in succession, and end up with only “g”. That’s why you need, as others said, to “append” stuff.

    However, simpler than what others have said, there is only one line that you need inside this whole for loop.

    display.setText(display.getText() + testarray[l]);
    

    And that is all you need.

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

Sidebar

Related Questions

I'm using this code and I'm beyond frustration: try { $dbh = new PDO('mysql:dbname='
I am currently using code similar to this: try { // IE ONLY var
For some reason, when I try to run this code, all I get is
I've been using this code to try and get data from the google weather
Using something like this: try: # Something... except Exception as excep: logger = logging.getLogger(component)
when using this method public List<Field> getFieldWithoutId(List<Integer> idSections) throws Exception { try { Connection
if in a literal object i try to reference a function using this inside
When I try to login to this site using my yahoo openid, it takes
I try to get this following url using the downloadURL function as follows: http://www.ncbi.nlm.nih.gov/nuccore/27884304
I'm using Google Translate API, and if I try to translate Mc Donald's this

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.