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?
Betty Rubble? Well, I would go with Betty... but I'd be thinking of Wilma.
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!
Betty Rubble? Well, I would go with Betty... but I'd be thinking of Wilma.
Which line does the error point to? (Just double-click on the error in the problems view.)
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
Yeah, but how did the squirrel get in there? Was it because of the tiny ad?
Free, earth friendly heat - from the CodeRanch trailboss