Hi there. As I said, I'm a newbie to programming and writing code. I'm at home working on a lab project but keep getting a compilation error and I don't know how to fix it. Any help would be greatly appreciated. Here's my code:

public void add(int i)
{
int newValue;
newValue = accumulator;
accumulator = accumulator + i;
System.out.println(newValue " + " i " = " accumulator);
}

BlueJ highlights the System.out.println and displays, ')' expected error. Thank you!

You can't just put variables and strings next to one another. You need to concatenate them with the + operator: newValue + " + " + i

ooooh, right! thank you so much!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.