Q. What will be the output of following java code?

Code:
public class Test{
      static int i = 5;
      public static void main(String... args){
            System.out.println(i++);
            System.out.println(i);
            System.out.println(++i);
            System.out.println(++i+i++);
      }
}
  • (A) 6 6 6 16
  • (B) 6 7 6 16
  • (C) 5 6 7 16
  • (D) 5 6 6 16
πŸ’¬ Discuss
βœ… Correct Answer: (C) 5 6 7 16

You must be Logged in to update hint/solution

πŸ’¬ Discussion


πŸ“Š Question Analytics

πŸ‘οΈ
186
Total Visits
πŸ“½οΈ
4 y ago
Published
πŸŽ–οΈ
Shivam
Publisher
πŸ“ˆ
97%
Success Rate