Java Basic

Quiz Guidelines


Multiple Choice Question


Which of the following lines can be inserted at line 1 to make the program run?

//line 1
public class TestClass{
public static void main(String[] args){
PrintWriter pw = new PrintWriter(System.out);
OutputStreamWriter osw = new OutputStreamWriter(System.out

Assume that PrintWriter and OutputStreamWriter are valid classes in package. 

Select 1 option

A. import java.lang.*;
B. import*;
C. import;
D. include*;
E. include java.lang.System;

Multiple Choice Question


Which of these statements concerning the use of modifiers are true?

Select 1 option

A. By default (i.e. no modifier) the member is only accessible to classes in the same package and subclasses of the class. 
B. You cannot specify visibility of local variables. 
C. Local variable always have default accessibility. 
D. Local variables can be declared as private. 
E. Local variables can only be declared as public.