+ 2
How can i call it ? Sum method see code in description
public class Program { public static void main(String[] args) { double a = 42.571; int b = (int) a; // how can call it sum((int) a , b); } // without changing it public void sum(int c, int d){ System.out.println(c+d); } }
3 ответов
+ 2
Use 'static' .
I have a request:
When you post same code examples please use the plus Symbol (+) to add your code in your post. Thank you.
Regards kiuziu
+ 1
you need to change the function to
static public void sum(int c, int d){
System.out.println(c+d);
}
+ 1
Thanks it seem very easy