Consider this code:
// Create a Item oject
item item = new item();
Compiler error message:
Error - Cannot find symbol - Constructor item();
Class item
:
public class item
{
// Attributes
private String Itemcode;
private String Itemname;
private String Description;
private String Style;
private String Finish;
private float Unitprice;
private float Stock;
private String Suppliercode;
private String Suppliername;
private String Address;
public item(String ItemcodeIn, String ItemnameIn, String DescriptionIn,
String StyleIn, String FinishIn, float UnitpriceIn, float StockIn,
String SuppliercodeIn,
String SuppliernameIn, String AddressIn)
{
Itemcode = ItemcodeIn;
Itemname = ItemnameIn;
Description = DescriptionIn;
Style = StyleIn;
Finish = FinishIn;
Unitprice = UnitpriceIn;
Stock = StockIn;
Suppliercode = SuppliercodeIn;
Suppliername = SuppliernameIn;
Address = AddressIn;
}
And this code is then followed by all of the setter/getter methods for the attributes.
How can I fix this problem?
PascalCase
for class names andcamelCase
for variable names. So, if you followed the convention, your class name would beItem
and your variable names would beitemCodeIn
,itemNameIn
,item
, etc.