java problem???? can some one help me??? im a newbie?

MaxG

New member
Joined
Jul 5, 2008
Messages
18
Reaction score
0
Points
1
int gra[] = new int [10];
String out1="";
String out2="";
String out3="";
String out4="";
System.out.println("BAR CHART");
System.out.println("Please input grade of: ");
for(int x=0;x<gra.length;x++){
System.out.print("Student"+(x+1)+":");
gra[x]=Integer.parseInt(br.readLine());

if(gra[x]<=99 && gra[x]>=96)
out1+="*";
else if(gra[x]<=95 && gra[x]>=91)
out2+="*";
else if(gra[x]<=90 && gra[x]>=85)
out3+="*";
else
out4+="*";
}
System.out.println("**************************");
System.out.println("Grade Chart: ");
System.out.println("96-99:"+out1);
System.out.println("91-95:"+out2);
System.out.println("85-90:"+out3);
System.out.println("Below 85:"+out4);









what do you mean by this java statement???(out1+="*")????


can someone explain???


youre answers will be of great help...thanks
 
It adds the * (star) to the string out1.
out1 = ""
out1+="*"
out1+="*"
out1+="*"
//this would make the out1="***"
 
once a String variable has been initialized, you can keep adding to it...

String s; // not init
String w = ""; is init

w += "x";
w += " ";
w += "one two three and more."
s = "";
s += "see";
 
Back
Top