πŸ“Š JAVA
Q. What is the output of the program?
class Test{
public int display(int x, int y){
return ("The sum of x and y is " + x + y);
}

public static void main(String args[]){
Test test = new Test();
System.out.println(test.display(4,5));
}
}
  • (A) The sum of x and y is 9
  • (B) The sum of x and y is 45
  • (C) does not compile
  • (D) None of the above
πŸ’¬ Discuss
βœ… Correct Answer: (C) does not compile

Explanation: Return type of method display is int and we are trying to return string.

Explanation by: Priyanka Tomar
Return type of method display is int and we are trying to return string.

πŸ’¬ Discussion


πŸ“Š Question Analytics

πŸ‘οΈ
88
Total Visits
πŸ“½οΈ
1 y ago
Published
πŸŽ–οΈ
Priyanka Tomar
Publisher
πŸ“ˆ
99%
Success Rate