+ 1

Как использовать функции в java?

https://code.sololearn.com/c8B9K9oE82WU/?ref=app

20th Jun 2021, 8:01 PM
МамаЗузу
4 Antworten
0
Функция в классе Func.Как её использовать в классе main,чтобы получить результат?
20th Jun 2021, 8:03 PM
МамаЗузу
0
public class Main { public static int function1(){ int a = 5; return a; } } public class Program { public static void main(String[] args) { System.out.println(Main.function1()); //method is in other class and it is a static method so you have to call it by class name like the above } }
20th Jun 2021, 8:06 PM
Jayakrishna 🇮🇳
0
thanks you very much!
20th Jun 2021, 8:07 PM
МамаЗузу
0
You're welcome..
20th Jun 2021, 8:08 PM
Jayakrishna 🇮🇳