Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Concatenation with integers & strings

719965Sep 21 2008 — edited Sep 21 2008
I am new to java and was wondering how to concatenate strings with integers. Do I need to first change an int to its character value before concatenating it with a string? Most of the languages I have used will convert types automatically, but I'm new to Java.

I am trying to set up a for/next loop to allow the user to input student names for the grade book.
I have defined Student1Name, Student2Name, and Student3Name as strings.
I have also created a Scanner object:
Scanner inputStudent = new Scanner (System.in);

for (int i = 1; i < 4; i++)
{
System.out.print ("Please enter the name of student" + i + ": ");
"Student" + i + "Name" = inputStudent.nextLine();
}

Thank you for any help you can provide!
- Jeff C
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 19 2008
Added on Sep 21 2008
7 comments
449 views