What is the output of this simple java code 6 and not 4? -
what output of simple java code 6 , not 4? since int x = 10 , int y = 15, how come able declare int x , int y again 5 , x-2? thought can declare value of int once? thanks, sorry i'm new java.
here's code:
public class shortq { public static void main (string args[]) { int x = 10 , y =15; x = 5; y = x-2; system.out.println(x+1); } }
also since int x = 10 , int y = 15, how come able declare int x , int y again 5 , x-2? thought can declare value of int once? thanks, sorry i'm new java.
x = 5; y = x-2;
with above not declaring variable doing assignment. in post there 1 time declaration i.e int x = 10 , y =15;
how output of simple java code 6 , not 4?
as x 5 , adding 1 while printing
x = 5; system.out.println(x+1);
Comments
Post a Comment