- 1

sum ko call kraya bina object bnay kyo ki ye static method h but ise x m assign hi kyu kiya print krane k liye

class MyClass { static int sum(int val1, int val2) { return val1 + val2; } public static void main(String[ ] args) { int x = sum(2, 5); System.out.println(x); } } // Outputs "7"

29th Apr 2018, 6:23 PM
anshul sen
anshul sen - avatar
1 Answer
+ 4
Try clarifying your question, and I'm sure somebody will be happy to help answer. Cheers.
3rd Feb 2020, 1:14 PM
Tony
Tony - avatar