nerdexam
Android

AND-401 · Question #87

Which of the following lines of code starts activity Activity2 from a current activity Activity1?

The correct answer is D. Intent intent = new Intent(this,Activity2.class). See the full explanation below for the reasoning.

Question

Which of the following lines of code starts activity Activity2 from a current activity Activity1?

Options

  • AIntent intent = new Intent(this,new Activity2());
  • BIntent intent = new Intent(new Activity2());
  • CIntent intent = new Intent (Activity1.class,Activity2.class);
  • DIntent intent = new Intent(this,Activity2.class);

How the community answered

(32 responses)
  • A
    3% (1)
  • B
    9% (3)
  • C
    3% (1)
  • D
    84% (27)

Community Discussion

No community discussion yet for this question.

Full AND-401 Practice