Join
Blogs
Questions
Videos
Tags
Members
Search
 
 
Create your own blog, earn points and get popular!

What will happen when you attempt to compile and run the following code?

  1. public class Demo
  2. {
  3.    static
  4.    {
  5.        int i = 10;
  6.    }
  7.  
  8.    static int i;
  9.    public static void main(String args[])
  10.    {
  11.            i–-;
  12.            System.out.println(i);
  13.    }
  14.    static
  15.    {
  16.        i–-;
  17.    }
  18. }

a. 8
b. 10
c. 9
d. None of the above
Your rating: None Average: 3 (1 vote)
Share this

Post new comment

1 + 8 =
Solve this simple math problem and enter the result. E.g. for 1+3, enter 4.