class R
{
static int test( int i )
{
return i--;
}
public static void main(String args[])
{
int i = 0;
System.out.println(test(i++));
System.out.println(i);
i = 0;
System.out.println(test(i--));
System.out.println(i);
}
}
32. Program
//What will be the O/P ?
class S
{
static int test( int i )
{
return ++i;
}
public static void main(String args[])
{
int i = 0;
System.out.println(test(i++));
System.out.println(i);
i = 0;
System.out.println(test(i--));
System.out.println(i);
}
}
33. Program
//What will be the O/P ?
class T
{
static int test( int i )
{
return i++;
}
public static void main(String args[])
{
int i = 0;
System.out.println(i);
i = test(i++);
System.out.println(i);
}
}
34. Program
//What will be the O/P ?
class U
{
static int test( int i )
{
return i--;
}
public static void main(String args[])
{
int i = 0;
System.out.println(i);
i = test(i--);
System.out.println(i);
}
}
35. Program
//What will be the O/P ?
class V
{
static int test( int i )
{
return i++;
}
public static void main(String args[])
{
int i = 0;
int j = test(i++) + i;
System.out.println(i);
System.out.println(j);
}
}
36. Program
//What will be the O/P ?
class W
{
static int test( int i )
{
return ++i;
}
public static void main(String args[])
{
int i = 0;
int j = test(i++) + i + test(++i); // 1 + 1 + 3
System.out.println(i);
System.out.println(j);
}
}
37. Program
//What will be the O/P ?
class X
{
static int test( int i )
{
return i++;
}
public static void main(String args[])
{
int i = 0;
int j = i++ + i + test(i++) + ++i + test(i++) + i
+ --i + test(i--) + i + i + test(i--) + ++i;
System.out.println(i); // 2
System.out.println(j); // 26
}
}