My class only compiles in Java 1.6 and not in Java 1.5
Hi, my java class wont compile in java 1.5, it only compiles in Java 1.6. How can i compile the following?
import java.util.*;
public class ShoppingBasket
Vector products;
public ShoppingBasket() { products = new Vector(); }
public void addProduct(Product product)
boolean flag = false;
for(Enumeration e = getProducts(); e.hasMoreElements();)
{ Product item = (Product)e.nextElement();
if(item.getId().equals(product.id))
{flag = true; item.quantity++; break; }
if(!flag){ products.addElement(product);}
public void deleteProduct(String str)
for(Enumeration e=getProducts();
e.hasMoreElements();)
{ Product item = (Product)e.nextElement();
if(item.getId().equals(str))
{products.removeElement(item); break; }
public void emptyBasket(){products = new Vector();}
public int getProductNumber(){ return products.size();}
public Enumeration getProducts() { return products.elements(); }
public double getTotal()
Enumeration e = getProducts();
double total; Product item;
for(total=0.0D;e.hasMoreElements(); total+= item.getTotal())
{item = (Product)e.nextElement(); }
return total;
}It should link with a class called Product which compiles fine... the errors i get are below:
K:\jakarta-tomcat-5.0.18\webapps\ROOT\WEB-INF\classes\ShoppingBasket\ShoppingBas
ket.java:6: cannot find symbol
symbol : class Product
location: class ShoppingBasket
public void addProduct(Product product)
^
K:\jakarta-tomcat-5.0.18\webapps\ROOT\WEB-INF\classes\ShoppingBasket\ShoppingBas
ket.java:10: cannot find symbol
symbol : class Product
location: class ShoppingBasket
{ Product item = (Product)e.nextElement();
^
K:\jakarta-tomcat-5.0.18\webapps\ROOT\WEB-INF\classes\ShoppingBasket\ShoppingBas
ket.java:10: cannot find symbol
symbol : class Product
location: class ShoppingBasket
{ Product item = (Product)e.nextElement();
^
K:\jakarta-tomcat-5.0.18\webapps\ROOT\WEB-INF\classes\ShoppingBasket\ShoppingBas
ket.java:20: cannot find symbol
symbol : class Product
location: class ShoppingBasket
{ Product item = (Product)e.nextElement();
^
K:\jakarta-tomcat-5.0.18\webapps\ROOT\WEB-INF\classes\ShoppingBasket\ShoppingBas
ket.java:20: cannot find symbol
symbol : class Product
location: class ShoppingBasket
{ Product item = (Product)e.nextElement();
^
K:\jakarta-tomcat-5.0.18\webapps\ROOT\WEB-INF\classes\ShoppingBasket\ShoppingBas
ket.java:35: cannot find symbol
symbol : class Product
location: class ShoppingBasket
double total; Product item;
^
K:\jakarta-tomcat-5.0.18\webapps\ROOT\WEB-INF\classes\ShoppingBasket\ShoppingBas
ket.java:36: inconvertible types
found : <nulltype>
required: double
for(total=0.0D;e.hasMoreElements(); total+= item.getTotal())
^
K:\jakarta-tomcat-5.0.18\webapps\ROOT\WEB-INF\classes\ShoppingBasket\ShoppingBas
ket.java:37: cannot find symbol
symbol : class Product
location: class ShoppingBasket
{item = (Product)e.nextElement(); }
^
8 errors
fahafiz wrote:
ah, so should i put the classes into the folder which the classpath is assigned to?More likely you should assign your classpath to whatever folder your classes are in.
Put your files where they make sense, and then fill in classpath accordingly:
javac -classpath classpath MyFile.java(I think, it's been a while since I compiled from the command-line, see http://java.sun.com/j2se/1.4.2/docs/tooldocs/windows/javac.html)
Similar Messages
-
Diff was java add in and stand alone java instance
Hi Guys ,
What is the diff between was java add in and stand alone java instance ?
Thanks
SonamHai,
SCS is nothing but the SAP Central Services, it is AS Java instance of an SAP system containing the enqueue server and the message server.
JAVA Addin is inserted in exsisting ABAP only instance to have JAVA functionality. JAVA instance is assigned to an ABAP instance. The Internet Communication Manager (ICM) of the ABAP instance starts and stops the associated Java instance as required.
Netweaver JAVA (Stand alone) vs JAVA Addin:
Netweaver JAVA Addin installation is a dual installation that consists of Java and ABAP stack. Addin is required when you are implementing SAP XI (Exchange Infrastructure). Stand alone JAVA is required when you implement SAP EP (Enterprise Portal). It is generally not recommended to use dual installation for EP because this will expose the ABAP layer to the public Internet. So the ABAP stack is often used to host SAP ERP ECC (Enterprise Central Component), SAP CRM, SAP SCM, etc.,
Since the information hosted on ABAP stack is more sensitive in nature you are recommended to install Portal on the Netweaver AS Java server (Stand alone JAVA server).
By doing this you will be able to fully utilize the system resources for the portal and ensure good performance.
Regards,
Yoganand.V -
On my ipod touch I'm not too sure how I uploaded a album onto my ipod from my laptop. But, now there is no way to delete the album full of pictures. What do I do? I only gotten it a while ago and not fully sure how to work it. Help?
http://support.apple.com/kb/HT4236
-
How do I only show my inbox on email and not all the support folders
How do I only show my inbox on email and not all the support folders
There is a third-party program called Attachment Tamer that will do that for you. In the Terminal, you can type this:
defaults write com.apple.mail DisableInlineAttachmentViewing -bool yes
Also note that while Attachment Tamer does some things with the encoding that makes certain email clients display the item as an attachment, what shows up at the receiver's end is solely dependent on their email client and its settings. -
can someone pls help me with java on my macbook pro because after i download the mountain lion java has died and i need java to see streaming quotes from stock market
Java is no longer included in Mac OS X by default. If you want Java, you will have to install it.
However, note that you should think twice before installing Java for such a trivial need as looking at stock market quotes. There are other ways to get that information that don't involve Java, and using Java in your web browser is a HUGE security risk right now. Java has been vulnerable to attack almost constantly for the last year, and has become a very popular, frequently used method for getting malware installed via "drive-by downloads." You really, truly don't want to be using it. See:
Java is vulnerable… Again?!
http://java-0day.com -
how do i get my contacts back? they are backed up by i cloud but when I "MERGE" only the new ones are there and not the old ones
Hi sfuentes,
You need to check iCloud to see if they are actually there. Go to iCloud.com and sign in and then look at your Contacts there to see if the old ones are still showing on iCloud.
If they are not, then you can either re-enter them while you are on iCloud.com, or you can restore your device from the backup where you saved them:
https://support.apple.com/kb/ph12521
Cheers,
GB -
I created a new library so I can use it for just my music, but now my ipod will only sync to my old library and not the new one I created, even though I'm in the new library when I open itunes. Any solutions?
The point is that there are four i product users for one computer in my house, and not everyone wants the same music on their device. Like I said before, the ipod is not syncing to the new library even though I plug it in when the new itunes library is pulled up. It keeps syncing to the old library...
-
Can i get the time capsule to automatically back up my file from my Mac Book Air but have certain files which are only stored on the time capsule and not the computer? Then can i access these files only on the time capsule without connecting it?
igonneau wrote:
Can i get the time capsule to automatically back up my file from my Mac Book Air but have certain files which are only stored on the time capsule and not the computer?
You can, but how are you going to back up those other files? When (not if) your Time Capsule fails, you risk losing them. See #Q3 in Using Time Machine with a Time Capsule for details.
Then can i access these files only on the time capsule without connecting it?
Not sure what you mean. You have to connect a computer, either via Ethernet cable or wirelessly, to read or write to the disk. -
Hi! Please help. I have synced my IPhone 5 to Itunes. When I try to sync it to Iphone 6 plus, only the contacts, calendar, safari bookmarks and notes have synced to the latest date. The rest like SMS and Call History have only synced to June 2013.
I upgraded from an iPhone 4S to iPhone 6 Plus, I don't like to run iTunes, and iCloud backup is not so reliable, I think. Then I searched on the Internet, and some articles told me that I can directly transfer data from Phone to iPhone with some tools.
I doubt it first, then I gave a shot on one of them for the free trial. I follow the steps to transfer about 200 sms from my 4S to 6 Plus, and it works!
Got this from here: http://www.cultofmac.com/296711/transfer-data-new-iphone-6-imazing/
Hope this helps! -
since i updated my Apple ID with correct email address I can now only send imessages to email addresses and not iphone numbers - any idea how to fix this problem ?
You might want to try contacting Apple for assistance by going to https://expresslane.apple.com, then click See All Products and Services>iTunes>iTunes Store>Passwords & Security Questions>Lost or Forgotten Apple ID password. They should be able to explain what's going on and help you reset the password for the old ID if necessary. The call should be free.
-
HT4597 Why can I only see new mail in icloud and not in my normal in box
Why can I only see new mail in icloud and not in my usual mail in box
sonnay, are you also in South Africa like the original poster whose message you tacked onto?
A lot of countries only have app store, no music or video stores. Because of copyright laws that are different between every nation. Stupid, that the laws are different, but that's the way it is. -
Bought Elements and it appears I got only the part to edit photos and not movies. How do I get part 2 of my order?
Please post Photoshop Elements related queries over at
http://forums.adobe.com/community/photoshop_elements -
I need help finding phots just downloaded to lightroom...they only show up in "prevoious downloads" and not in a folder in my pictures. what can I do to correct this?
Also, please be aware that Lightroom is not a file browser like your operating system Finder or Explorer is. If the photos are not in the folder you expected them to be in, it is because you (accidentally) imported them into a different folder.
-
i have an 8GB ipod touch and suddenly I'm able to access only the "sent" mailbox of Mail and not the other mailboxes. I turned on and off. I connected it to MacBook but still I can't access the other mailboxes.
- Try resetting the iPod:
Reset iPod touch: Press and hold the On/Off Sleep/Wake button and the Home
button at the same time for at least ten seconds, until the Apple logo appears.
- Can you access the mail on another device? -
Hi there,
I have a ipad2, when I go to my ringtones I do have sound, if I go to music, skype or watch youtube I only have sound through my earphones and not my internal speaker. I'm not connected to any bluetooth device or anythingTry plugging your earphones in and remove them again. Do that a few times ... Plugin and uplug ... and see if the sound comes back for the speakers.
Maybe you are looking for
-
Writing to A text file that is located on an online directory.
I have an application that several users will be using. The program outputs a string when a submit button is clicked. I have a txt file called Data.txt which resides on a web directory with the following url. http://nath5.hostrator.com/............/D
-
TouchPad has stopped working in Satellite L300
Hi Xaxer, hi there, as I dont know how to post a new topic, I just reply (I apologize for that way). The touch pad on my L300 has stopped working. (Vista 32 bit). Fn and F9 does not change anything. USB-Mouse works fine. Downloaded new touch-pad driv
-
PS CS6 spot healing brush stopped working. followed online instructions but it did not work
I followed online instructions for resetting preferences and tools, but the spot healing brush no longer works. Help!
-
Support Package SAPKB71101 hangs while applying
Hi, I am applying basis support package SAPKB71101, it is getting hanged in Main Import. I was trying to import from last 4 days. But still it is hanged in the Main Import only. When i try to check the log in Slog, i am getting the warning as /usr/sa
-
Removing Role expert from the GRC Pad
Hi Guys we are using three products of GRC ie RAR , SUP and Compliance user provisioning but NOT the Role Expert. Is there any way that I can show only these three tools in the GRC pad and remove the Role expert. At the moment it is grey out but stil