PDA

View Full Version : Having difficulty with Java String


BritishBulldog
Oct 24, 2013, 06:16 AM
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;

for (int I = 0; I < wordcount; I++) {

words += numberofwords;

}

System.out.println ("the letters are : + words);

}

Scleros
Nov 30, 2013, 09:26 AM
You are missing a quote.