Compiler seems to be hanging up on "new" but I know it isn't but I can't seem to figure out what it is that it doesn't like. Been chasing my tail for the last couple of days. Any help would be greatly appreciated.
Here's is the compiler message: InventoryItemDe mo.java:9: cannot find symbol
symbol : constructor InventoryItem(j ava.lang.String ,int)
location: class InventoryItem
InventoryItem Item1 = new InventoryItem(" Item 1", 41),
^
There are four more lines that say the same thing since I am trying to create 5 InventoryItems. The carrot should be under the word new.
My code is fairly simple at this point
I am not usind Scanner for anything, I just through that in to verify that there isn't a problem with new. I suppose I should mention that I get an errorish message when I compile the InventoryItem class: "InventoryItem. java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details." From what I understand (which is very little) the Xlint error is informational and my InventoryItem.c lass file is created.
Here's is the compiler message: InventoryItemDe mo.java:9: cannot find symbol
symbol : constructor InventoryItem(j ava.lang.String ,int)
location: class InventoryItem
InventoryItem Item1 = new InventoryItem(" Item 1", 41),
^
There are four more lines that say the same thing since I am trying to create 5 InventoryItems. The carrot should be under the word new.
My code is fairly simple at this point
Code:
import java.util.Scanner; public class InventoryItemDemo { public static void main (String[] args) { Scanner keyboard = new Scanner (System.in); InventoryItem Item1 = new InventoryItem("Item 1", 41), Item2 = new InventoryItem ("Item 2", 12), Item3 = new InventoryItem ("Item 3", 33), Item4 = new InventoryItem ("Item 4", 35), Item5 = new InventoryItem ("Item 5", 47); } }
Note: Recompile with -Xlint:unchecked for details." From what I understand (which is very little) the Xlint error is informational and my InventoryItem.c lass file is created.
Comment