![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjEXTXHf-ZtYEcMCw0rH1HhVatUCqNAI_r6XhiY2jOb21e1XU8CU2KtjyU4vJcIe7U0Yem6Ag_FqlcNLOgzXAhmu34b4WfNawRVZetgNXdhhNahAZM9t8lJOkeLl7BI998YjH1PjpUvdgaM/s1600/Untitled.jpg)
What will be the output of following java program ?
class SomeClass
{
static int i ;
public SomeClass()
{
i = 1;
}
private static int increment(int i)
{
return ++i;
}
public static void main(String[] args)
{
System.out.print(i);
System.out.print(increment(i));
System.out.print(i);
}
}
Options
1. 000
2. 012
3. 010
4. compilation error
Answer:
Option 3 is the correct choice .
No comments:
Post a Comment