📢 Too many exams? Don’t know which one suits you best? Book Your Free Expert 👉 call Now!


    Question

    Consider the following Java code: public class

    LengthMix {     public static void main(String[] args) {         int[] numbers = {10, 20, 30, 40};         String message = "Java";         System.out.println(numbers.length + message.length());     } } What will be the output of this program?
    A 4 Correct Answer Incorrect Answer
    B 8 Correct Answer Incorrect Answer
    C 10 Correct Answer Incorrect Answer
    D 12 Correct Answer Incorrect Answer
    E Compile-time error Correct Answer Incorrect Answer

    Solution

    Correct Answer: B (numbers.length is 4. message.length() is 4. Sum = 8.)

    Practice Next
    ask-question