Ask Experts Questions for FREE Help !
Ask
    Besim's Avatar
    Besim Posts: 1, Reputation: 1
    New Member
     
    #1

    Oct 8, 2014, 10:54 AM
    Java string concatenation in the iteration
    Hi everyone can any help me with this:


    Make a program that asks for an integer and prints all integers from one to the entered integer. By performing a string concatenation in the iteration, let the label text value to be the value it had last lap plus the new century.

    Thanks to everyone for his time.
    CravenMorhead's Avatar
    CravenMorhead Posts: 4,532, Reputation: 1065
    Adult Sexuality Expert
     
    #2

    Oct 8, 2014, 11:16 AM
    This won't compile:
    ----
    string entry;
    for(I = 1 to number)
    entry.append("%s %d",entry,number);
    ----

    It is simple to take an empty string, and run it through the loop. Each time through to append/concatenate the iterative number on the end.

Not your question? Ask your question View similar questions

 

Question Tools Search this Question
Search this Question:

Advanced Search

Add your answer here.


Check out some similar questions!

Random Generate String from ArrayList without replacement in JAVA [ 0 Answers ]

I am trying to create a program that will allow users to enter a list of names. And then the program will pull from the ArrayList randomly and pull each name one at a time until all names have been used.The auction class by itself i working fine. Problem is in the Draft class. I want to take the...

How to store Scanner data in string in java? [ 0 Answers ]

I am new to java, currently I am working on a program regarding networking. My program compiles without error. I have placed 3 checks in my program. It passes through check 1 but does not reach 2. I want string player2msg to store whatever data comes from scanner fromServer. I expected...

Having difficulty with Java String [ 1 Answers ]

Can someone please me how I can write a Java code to transform the quantity 6 As into the string AAAAAA. I'm trying this, but it does not work: public class Letters { public static void main (String args) { String words=" "; String numberofwords="A"; int wordcount=6;

Which is the best option between concatenation and striping when expanding a lun [ 2 Answers ]

Which is best option between concatenation and striping a lun to create a metalun in the clariion environment?


View more questions Search