473,386 Members | 1,841 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

cannot find symbol error

suzee_q00
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: InventoryItemDemo.java:9: cannot find symbol
symbol : constructor InventoryItem(java.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

Expand|Select|Wrap|Line Numbers
  1. import java.util.Scanner;
  2.  
  3. public class InventoryItemDemo
  4. {
  5.     public static void main (String[] args)
  6.     {
  7.         Scanner keyboard = new Scanner (System.in);
  8.  
  9.         InventoryItem Item1 = new InventoryItem("Item 1", 41),
  10.                             Item2 = new InventoryItem ("Item 2", 12),
  11.                              Item3 = new InventoryItem ("Item 3", 33),
  12.                              Item4 = new InventoryItem ("Item 4", 35),
  13.                              Item5 = new InventoryItem ("Item 5", 47);
  14.     }
  15. }
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.class file is created.
May 9 '09 #1
2 2848
dmjpro
2,476 2GB
Is InventoryIntem class file in the same directory as the main class is in?
May 9 '09 #2
JosAH
11,448 Expert 8TB
@dmjpro
That doesn't have much to do with it: it's a classpath issue: the compiler doesn't know where it can find that class symbol and it doesn't necessarily look, by default, in a current directory; it doesn't look in any directory by default.

kind regards,

Jos
May 9 '09 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Tony Johansson | last post by:
Hello! I get compile error when compiling using the command javac from the command terminal window(CMD). I have just two classes which are called HelloWorld.java and Slask.java. I have both...
15
by: Bjorn Jensen | last post by:
Hi! An beginner question: Pleas help me with this (-: Error (the arrow points on the s in sqrt) ===== tal.java:6: cannot find symbol symbol : method sqrt(int) location: class tal...
1
by: vsp15584 | last post by:
Hii..i use the coding as below :- import java.applet.applet; import java.awt.*; import com.sun.j3d.utils.applet.mainframe; import com.sun.j3d.utils.universe.*; import...
1
by: Shiva48 | last post by:
Thanks to Gannon11 and ro351988- Moderator. I give below the complete Java file and pls help me to rectify the errors. package com.wrox.proj2ee.ch10.app; import java.io.*; import...
1
by: jank | last post by:
hi, I wrote sending mass email program in java. If i try to compile using ant compiler, i am getting this error. c:\mail\src\com\mail\action\SendMail.java:125: cannot find symbol ...
4
by: jingchua | last post by:
Hi, can anyone help out here???? I have the below error after compling the file. Any idea what is wrong in the declaration that was done in the above code??? Appreciate any help on shedding some...
2
by: karinmorena | last post by:
I'm having 4 errors, I'm very new at this and I would appreciate your input. The error I get is: Week5MortgageGUI.java:151:cannot find symbol symbol: method allInterest(double,double,double)...
10
by: CodeNoob | last post by:
please help been working on a project got it down to 5 errors from 100 now i have no idea what to do. Errors: init: deps-jar: Created dir: C:\Users\Tommy\Desktop\build\classes Compiling 306...
3
by: Sindhu Rani | last post by:
i hav created 3 classes in 3 different files. am gettin an error durin compilation. wat shud i do??? C:\s\source>javac -d ..\classes devtestdrive.java devtestdrive.java:5: cannot resolve symbol...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.