What will the following code print ?<br/><br/>public static void main(String[] args){<br/> Integer i1 = new Integer("1");<br/> Integer i2 = new Integer("2");<br/> Integer i3 = Integer.valueOf("3"); <br/> int i4 = i1 + i2 + i3; <br/> System.out.println(i4); <br/>} Integer i2 = new Integer("2");
Integer i3 = Integer.valueOf("3");
int i4 = i1 + i2 + i3;
System.out.println(i4);
}"> Integer i2 = new Integer("2");
Integer i3 = Integer.valueOf("3");
int i4 = i1 + i2 + i3;
System.out.println(i4);
}">
Javasearch.buggybread.com

Search Interview Questions


 More than 3000 questions in repository.
 There are more than 900 unanswered questions.
Click here and help us by providing the answer.
 Have a video suggestion.
Click Correct / Improve and please let us know.
Label / Company      Label / Company / Text

   



Interview Questions and Answers

 Q1. What will the following code print ?

public static void main(String[] args){
Integer i1 = new Integer("1");
Integer i2 = new Integer("2");
Integer i3 = Integer.valueOf("3");
int i4 = i1 + i2 + i3;
System.out.println(i4);
}
Core Java
Ans. 6

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     java   int   integer   scjp   ocjp


Related Questions

 Which of the following are valid declarations

1. void method(int... x){};
2. void method(int.. x){};
3. void method(int.. .x){};
4. void method(int ...x){};
5. void method(int... x){};
6. void method(int ... x){};
7. void method(int x, int... y){};
8. void method(int... x, int y){};
9. void method(int... x,int... y){};
 Can we overload method as following ?

void method(int... x){};
void method(int[] x){};
  Which of the following syntax is correct ?import static java.lang.System.*;or static import java.lang.System.*;
 Why following method declarations are not valid ?

void method(int... x, int y){};
void method(int... x,int... y){};
 Which method will get called if we call it as method(1)

void method(int x ){};
void method(int... x){};



Help us and Others Improve. Please let us know the questions asked in any of your previous interview.

Any input from you will be highly appreciated and It will unlock the application for 10 more requests.

Company Name:
Questions Asked: