GeneralizationsB.java


#1

There's something wrong, perhaps, with this code. I've checked it; it seems to fine. Though I click run and it runs continuously. The console displays correctly what the instructions say it must. For some unknown reason it keeps running on and on! Help please.
public class GeneralizationsB {
public static void main(String[] args) {

// ( 3 >= 3 && !(true || true) )
boolean tricky = false;	

if(2015 > 2016) {

		System.out.println("Stuck in the past...");

	}else {

		System.out.println("Upgraded to the future!");

	}


int subwayTrain = 5;

	switch (subwayTrain){

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

	}

}

}


#2

stuck on the same one, I hope we get it solved


#3

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

// ( 3 >= 3 && !(true || true) );
boolean tricky = false;

if(2015 > 2016) {

		System.out.println("Stuck in the past...");

	}else {

		System.out.println("Upgraded to the future!");

	}


int subwayTrain = 5;

	switch (subwayTrain){

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

	}

}

}


#4

I couldn't agree more.


#5

try setting if (tricky) instead if (2015>2016) in second part
that worked for me


#6

"this worked for me"

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

//( 3 >= 3 && !(true || true) )
boolean tricky = false; 


if (!(2015 < 2016)) {

		System.out.println("Stuck in the past...");

	}else {

		System.out.println("Upgraded to the future!");

	}


int subwayTrain = 5;

	switch (subwayTrain){

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

	}

}

}


#7

I just switched the if(2015 < 2016) { to if(2015 > 2016) {
(just flip the less than sign to a greater than sign)
and it worked for 2,
then just change the int subwayTrain = 9 to another case number


#12