public class Site { private int siteNumber; private String reserved; private String Name; private String licensePlate; private String postalCode; private int partyNumber; public Site(int site, String res, String nam, String lic, String post, int party) { site = siteNumber; res = reserved; Name = nam; lic = licensePlate; post = postalCode; party = partyNumber; } public int getSite() { return siteNumber; } } public class Campsite { public static void main (String[] args) { Site site1 = new Site(5, "Reserved", "Caroline Strickland", "A13 F4G", "A1M 3A1", 5); System.out.println("it is" + site1.getSite()); } } //site number (1 - 50) //is this a serviced or non-serviced site? //is the site reserved? //name of camper (last name, followed by first name) //license plate number (6 characters) //postal code //number in party
With this code, when I compile it under that name Campsite.java, I always get one error saying:
Campsite.java:1: class Site is public, should be declared in a file named Site.java
public class Site"
I do have a file called Site.class in my files though, so I'm wondering what's going wrong?