Given a sample code:
1 class SetVar {
2 private int i = 0;
3 public int plusOne() {
4 return + ++i ;
}}
5 public class Test {
6 public static void main(String[] args) {
7 System.out.println(new SetVar().plusOne());
}}
What will be the result? Choose the correct option?
(A) 2
(B) 1
(C) 0
(D) Compilation error at line no 9.
(B)
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.