+ 3
Explain me this code?
public class practice { public static void main (String[] args) { int x = 10; test(x); } static void test(int x) { System.out.println(x); } } I dont understand this code plz explain...
5 Respuestas
+ 5
It's easy :
1. Program execution starts from main method.
2. At test(x), the value of x goes as argument in test(x) method
3.Program jumps to test method definition
4.In method definition it prints the value of x which is 10 though System.out.println (x)
+ 14
Complete the Java course. Everything you wrote is covered by the course.
+ 1
no se nada de java pero con lo poco que se, te puedo decir que lo que hace es declarar una variable (x) al que le asigna el valor 10, luego llama a una función definida que lo que hace es pasar la variable x como argumento de la funcion y luego lo imprime, lo que da de salida 10.
+ 1
Facu I don't understand your language. Explain in English.
+ 1
I do not know anything about java but with what little I know, I can tell you that what you do is declare a variable (x) to which you assign the value 10, then call a defined function what it does is pass the variable x as argument of the function and then print it, what gives output 10. 🤦♂️