My code is not working, extremely confused

hello! i am a newbie to coding in general and was confused when told that my code did not work. the project is

it said ( or [ was expected but i wasn’t sure what that meant.

here it is:

public class Calculator{
Calculator ();{

public static int addNumbers(int a, int b) {
return a+b;

public static int subtractNumbers(int a, int b) {
return a-b;

public static int multiply(int a, int b) {
return a*b;

public static int divide(int a, int b) {
return a/b;

public static int modulo(int a, int b) {
return a%b;

public static void main(String args){
Calculator bob = new Calculator


can someone please tell me what the issue may be? thank you!

Welcome to the forums!

In future posts, please format your code using the </> button to make it easier for others to read it and help you. Posting the full error also helps.

Because you haven’t posted the full error, I might be missing something, but I have spotted two bugs in your code, one that might be related to your error.

First, the above. Do you know or remember how to define constructors? This is incorrect syntax and is probably what is causing the error.

Secondly, review the above line. What is the syntax for creating new objects? Also, you’re missing a semi-colon.

thank you so much! that really helped. i will use those tips and i will also make sure to format my posts better next time as well : ) thanks so much for helping out!

1 Like