Uninary Operator With Method

25. Program

//What will be the O/P ?

class L { static int test( ) { int i = 0; return i++; } public static void main(String args[]) { System.out.println(test()); } }

26. Program

//What will be the O/P ?

class M { 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); } }

27. Program

//What will be the O/P ?

class N { static int test( int i ) { return i--; } public static void main(String args[]) { int i = 0; System.out.println(i); System.out.println(test(i)); System.out.println(i); i = test(i); System.out.println(i); } }

28. Program

//What will be the O/P ?

class O { 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); } }

29. Program

//What will be the O/P ?

class P { static int test( int i ) { return --i; } public static void main(String args[]) { System.out.println(test(9)); int i = 0; System.out.println(test(i)); System.out.println(i); } }

30. Program

//What will be the O/P ?

class Q { 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); } }

Page....