(a) Write a Java program as follows:
Let i=2;
Print i;
Print 2 * (i++);
Print i;
Ans: 2, 4, 3
Let i=2;
Print i;
Print 2 * (i++);
Print i;
Ans: 2, 4, 3
(b) Write a Java program as follows:
Let i=2;
Print i;
Print 2 * (++i);
Print i;
Let i=2;
Print i;
Print 2 * (++i);
Print i;
Ans: 2, 6, 3
沒有留言:
張貼留言