Home > Net >  What does a dash before calling a function do in Java?
What does a dash before calling a function do in Java?

Time:04-19

What does it mean when a function has a dash before its name? Ex:

public static int myFunction(int x, int y){
}

-myFunction(x,y);

CodePudding user response:

So, the "-" term doesn't actually have a meaning. It's just used to subtract the term.

So you see, when a function returns a integer you can use a - to make the number negative and vice versa.

If the function returns a 1 it'll become -1

CodePudding user response:

It means the same thing as a minus before any other number. It takes the negative of it. If myFunction(x, y) returns 7, then -myFunction(x, y) is -7.

CodePudding user response:

its a minus sign before function of int type. Therefore this construction is holding result of myFunction(x,y), but with inversed sign.

  •  Tags:  
  • java
  • Related