Multiple Choice Question

Quiz Guidelines

 

QID: 
5
Question: 

What will the following code print when run?

public class TestClass {

       public void switchString(String input){

          switch(input){

              case "a" : System.out.println( "apple" );

              case "b" : System.out.println( "banana" );

              break;

              case "B" : System.out.println( "Banana" );

              default :  System.out.println( "none" );

       }

}

public static void main(String[] args) throws Exception {

        TestClass tc = new TestClass();

        tc.switchString("B");

    }

}

Select 1 option

A. banana

Banana

B. Banana

none

C. Banana

D. banana

E. The code will not compile.

Q&A Set: 

Search the Web

Custom Search

Searches whole web. Use the search in the right sidebar to search only within javajee.com!!!