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

Q What is the output for the below code?
public class Test{
      int _$;
      int $7;
      int do;

      public static void main(String argv[]){
            Test test = new Test();
            test.$7=7;
            test.do=9;
            System.out.println(test.$7);
            System.out.println(test.do);
            System.out.println(test._$);
      }
}

Question ID
#2021
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 7 9 0
  • B Compile error - $7 is not valid identifier.
  • C 7 0 0
  • D Compile error - do is not valid identifier.
Correct Answer: D

Explanation

Compile error - do is not valid identifier.

Share This Question

Share this MCQ with your friends or study group.