problem with statement

J

Jeremy Watts

Hi,

I have the Java JDK installed on my old Sony Vaio laptop, but recently
switched to use my newer computer. I re-installed the Java development kit
(which used to be called the JDK ?? and now is called the SDK or
something.... Anyway I use the BlueJ IDE alongside it too, so also
downloaded that, so far so good.

I take a Java program from my old machine to try on my new set-up and theres
an error generated at a particular line, the error says :-

" '(' or '[' expected "

And the line in question is :-

"List<Object>result = new ArrayList<Object>();"

This works fine on my old set-up but not on the new!!??? Why?????????

Please save my mental health...

Jeremy Watts
 
T

Thomas Kellerer

Jeremy Watts wrote on 10.06.2007 13:26:
Hi,

I have the Java JDK installed on my old Sony Vaio laptop, but recently
switched to use my newer computer. I re-installed the Java development kit
(which used to be called the JDK ?? and now is called the SDK or
something.... Anyway I use the BlueJ IDE alongside it too, so also
downloaded that, so far so good.

I take a Java program from my old machine to try on my new set-up and theres
an error generated at a particular line, the error says :-

" '(' or '[' expected "

And the line in question is :-

"List<Object>result = new ArrayList<Object>();"

This works fine on my old set-up but not on the new!!??? Why?????????

Looks like on your old computer you had Java 1.5 installed and your new computer
has Java 1.4. You have to remove the (outdated) JDK from your new computer and
install a more recent version (Java6 aka 1.6 or Java5 aka 1.5)

Thomas
 
R

Roedy Green

I have the Java JDK installed on my old Sony Vaio laptop, but recently
switched to use my newer computer. I re-installed the Java development kit
(which used to be called the JDK ?? and now is called the SDK or
something.... Anyway I use the BlueJ IDE alongside it too, so also
downloaded that, so far so good.

I take a Java program from my old machine to try on my new set-up and theres
an error generated at a particular line, the error says :-

" '(' or '[' expected "

And the line in question is :-

"List<Object>result = new ArrayList<Object>();"

This works fine on my old set-up but not on the new!!??? Why?????????

I suspect you have installed a very old Java that does not understand
generics. See http://mindprod.com/jgloss/jdk.html
to get the latest JDK (Java Development Kit)
SDK is Microsoft's term.

follow the instructions for install and test.

Check out your installation with wassup
see http://mindprod.com/applet/wassup.html
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top