MCQ Practice Single Best Answer Topic: Java Data Types and Variables - MCQ

Q What is the output for the below code?
1. public class Test{
2.       public static void main(String[] args){
3.             byte b = 6;
4.             b+=8;
5.             System.out.println(b);
6.             b = b+7;
7.             System.out.println(b);
8.       }
9. }

Question ID
#2023
Subchapter
Java Data Types and Variables - MCQ
Action
Choose one option below

Choose Your Answer

Click an option to check whether your answer is correct.

  • A 14 21
  • B 14 13
  • C Compilation fails with an error at line 6
  • D Compilation fails with an error at line 4
Correct Answer: C

Explanation

Compilation fails with an error at line 6

Share This Question

Share this MCQ with your friends or study group.