Level 11 ...Help (Revise)


Q3: Set the value of the int variable subwayTrain equal to the case that will print "This is a Brooklyn bound train!" to the console.

public class GeneralizationsB {
public static void main(String[] args) {

int subwayTrain = ?;

	switch (subwayTrain){

		case 1 : System.out.println("This is a South Ferry bound train!");
		case 5 : System.out.println("This is a Brooklyn bound train!");
		case 7 : System.out.println("This is a Queens bound train!");
			System.out.println("I'm not sure where that train goes...");




int subwayTrain = ?


you have to print "This is a Brooklyn bound train!"

what should be the case to print that ?

if you set subwayTrain = 9 will it print that value?


Sorry .
subwayTrain = ? ..
How do I set the value of subwayTrain equal to that?


Did you understand how does switch case work?

consider if you set subwayTrain = 1 then what does it print and why so?


subwayTrain = 5 ;


The value will be 5.


Thank you!!


Thank you!!


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.