I get an error from from java compiler when I am trying to enter a class constructor with 4 parameters 2 of which are of the same type.Any ideas how to solve this?
code :
public Invoice ( String pNumber, String pDescription, int iQuantity, double iPrice )
That code looks fine and it certainly is legal to have multiple parameters of same type. Sounds as if you may have misinterpreted the compiler's complaints. Can you post the compiler output?
public class Invoice { private String partNumber, partDescription; //part number and part description private int itemQuantity; //item quantity private double itemPrice; //item price
Are you sure you're actually compiling the file you think you're compiling? Sometimes, one can get confused about directories. To be sure, rename or move the file you think you're compiling then try the compilation again. If it still compiles, you'd better find that other file!