Question: I don't know why I keep getting this error and I can't figure out what's wrong with my code. Flowers.java:33: error: class, interface, or enum

I don't know why I keep getting this error and I can't figure out what's wrong with my code.

Flowers.java:33: error: class, interface, or enum expected br.close(); ^ Flowers.java:34: error: class, interface, or enum expected System.exit(0); ^ 2 errors Error: Could not find or load main class Flowers

Here is my code:

import java.io.*; // Import class for file input.

public class Flowers

{

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

{

// Declare variables here

String flowerNames;

String sunOrShade;

// Open input file.

FileReader fr = new FileReader("flowers.dat");

// Create BufferedReader object.

BufferedReader br = new BufferedReader(fr);

// Write while loop that reads records from file.

while((flowerNames = br.readLine()) != null)

{

sunOrShade = br.readLine();

System.out.println(flowerNames + " is grown in the " + sunOrShade);

}

}

}

// Print flower name and the words sun or shade.

br.close();

System.exit(0);

// End of main() method

// End of Flowers class.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!