- 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"
1 Respuesta
+ 4
Try clarifying your question, and I'm sure somebody will be happy to help answer. Cheers.