11. Generalizations


#1

I'm getting the system to complete the assignment but it won't let me move on.
Is there something wrong with my code?
Thanks!

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

// ( 3 >= 3 && !(true || true) )
boolean tricky= ( 3 >= 3 && !(true || true) );
System.out.println(tricky);

if(2015 < 2014) {

		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

@metinte,

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...");
		}
	}
}

#3

@leonhard.wettengmx.n
Thanks!!


#4

I did what you told the other person but it is still not working. I am putting a link to my code academy.
(https://www.codecademy.com/en/courses/learn-java/lessons/conditionals-control-flow/exercises/generalizations-conditionals?action=resume) I don't know what to do.


#5


#6

I go to work.
Thank You


#7

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

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

	if(2016 < 2015) {

			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...");
	
		}

	}
}

#8

Reload the codecademy page. Sometimes when you "Run" and fail the first try, it doesn't reset.


#9

if ( 3 >= 3 && !(true || true) ) {
    
  	boolean tricky = true;  
    
  } else {
    
    boolean tricky = false;
    
  }

#10

I did so too but it is giving error even when it prints else code.


#11

After I did get code, the error message persisted.