Quiz on Java Basics
Test your knowledge of Java basics.
We'll cover the following...
We'll cover the following...
Technical Quiz
1.
What is displayed on the screen after the following program executes if the user inputs 2
and 5
, respectively?
import java.util.Scanner;
class Test
{
public static void main(String args[])
{
Scanner myObj = new Scanner(System.in);
String a = myObj.nextLine();
String b = myObj.nextLine();
System.out.print(a + b);
}
}
A.
It shows (2 + 5)
as a string.
B.
It shows 7
as a number.
C.
It shows 25
as a string.
D.
It shows 2 + 5
as a string.
1 / 10