I don't know why it doesn't compile ! !

import java.util.Scanner;

public class Beach {

	public static void main (String [] args) {
		
		Scanner input = new Scanner (System.in);
		
		System.out.println("Enter the weather Hot or Cold");
		
		String A;
	
		A = input.next();
		
		System.out.println("Enter the type of day Sunny or Windy or Rainy");
		
		String B;
		B = input.next();
		
		
		if(A.contains("Hot"))
		{
		
		    if(B.contains("Rainy"))
			{
			System.out.print("Don't go to Melbourne Beach");
			}
                
			else
			{
			System.out.print("Go to Melbourne Beach");
			}
		 
		 if(A.contains("Cold"))
		 {
		 
		 
			if(B.contains("Windy"))
			{
			System.out.print("Don't go to Melbourne Beach");
			}
			
			else
			{
			System.out.print("Go to Melbourne Beach");
        }
	}
}

Recommended Answers

All 4 Replies

because you don't have enough closing brackets ( } ) at the end of your class.
you're missing two.

add them, and it 'll work, but maybe they won't be on the right spot, didn't check for that.

Member Avatar for hfx642

If it doesn't compile, there will be error messages.
WE don't know why it doesn't compile either.
Maybe you should tells US.
THEN we can give you a hand.

there is one closing bracket missing just before "if(A.contains("Cold"))" to close the "if(A.contains("Hot"))" , and another closing bracket missing at the end to close the class

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.