for (int j =0; j < marks.size(); j++) {
analyzeTextArea.setText(j + marks.get(j));
}
The above code gives me the following error:
required: java.lang.String found: int
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
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.
I guess
marks.get(j)give you an Integer. So when you doj + marks.get(j)you add the value ofmarks.get(j)to the value ofj.So you end with an Integer as result of
j + marks.get(j). ButsetTextexpect a String.You have several possibilities now depending on you needs.
This case still make the addition then convert it to String in order to respect
setTextparameter type.With this :
""tells that the parameter will be a String and then you will concatenatejandmarks.get(j). So, for example, for the first loop you will have something that start with0Now using
setTextin a loop don’t really make sense because only the last value set in the loop will be used you probably should use JTextArea#append(String).