+ 1
If x=5 in one method and another method (x*x); is called inside it then sop(x)=5 in first method??
How Variable valve change
3 ответов
+ 2
Share your code so we can check the error.
+ 2
You didn't return x. So the value of x is not changed. Do the following changes:
public static void main (String [] args)
{
int x=5,y;
y=square (x);
System.out.print(y);
}
int square ( int x)
{
int y=x*x;
return y;
}
0
public static void main (String [] args)
{
int x=5;
Square (x);
System.out.print(x);
}
Static void square ( int x)
{
Int x=x*x;
}