Need help with the Calculator project

In step 2 i need to :
“Inside of the class, create a Calculator constructor. You can leave the contents of the constructor empty.”
and i didnt get it.

The same problem in step 3 :

“Next, create a public method that returns an int and call it add.”

Anyone can show me how it supposed to look like ?

1 Like

a constructor is a special method to set initial values for field variables.
it must have the same name of the class. if your class name is Calulator your method will be:

Calculator () {
// here you can init your class
// but it can be also empty…
}

@cloudrunner13472,

Maybe the Manual helps…
google search
== the Java Book ==
public int method site:docs.oracle.com
https://docs.oracle.com/javase/tutorial/java/javaOO/methods.html
and
https://docs.oracle.com/javase/tutorial/java/javaOO/returnvalue.html

1 Like