I tried to use List, but I needed the diamond modifiers (or whatever they’re called). Therefore, jME said that I needed to use JDK7.
Last time I used JDK7, compiled and sent the program to a friend, it didn’t run on his computer, but ran on mine. Setting it to JDK5 worked though. Therefore my question is - if I use JDK7, do the users need JDK 7 installed?
You don’t need the diamond operator. You need generics but that’s available since 1.5.
List= new ArrayList() instead of List = new ArrayList<>(). That’s the only difference the diamond operator gives you.
@zarch, I want to do something like this, though: public List _tileList = new ArrayList<>();
Can I do that like that?
First of all the user doesn’t need the JDK installed to play your game, they need the JRE. If you use 7 they need 7.
Didn’t know about the diamond operator, but as zarch says you don’t need it, sure its a nice convenience, but its not worth upgrading to Java 7 for, I’m still rolling with Java 6 <33
Thanks a lot for your useful post wezrule. Regarding the diamond operator - if I understand it well, without it, I can’t make an ArrayList exclusive to a type of object. Is that right?
Also, is this the JRE?
http://www.java.com/en/download/
@memonick said:
Thanks a lot for your useful post wezrule. Regarding the diamond operator - if I understand it well, without it, I can't make an ArrayList exclusive to a type of object. Is that right?
Also, is this the JRE?
http://www.java.com/en/download/
As Zarch said, that is generics, not the diamond operator.
Java 1.5 and up you can do
[java]
List<String> mylist = new ArrayList<String>() ;
[/java]
Java7 you can do
[java]
List<String> mylist = new ArrayList<>() ;
[/java]
The difference is, in java 7 you do not have to write "String" on both sides of the allocation, only on the left side. That is called the diamond operator.
If you compile a program with java 7 you can tell the compiler to be compatible with java 1.6 and your friend can run it.
If you do not say anything the compiler will use java7 and your friend must install java 7.
Alos, Java 1.6 is reaching end-of-life after the summer. No more support or bug fixes from Oracle after that. So your friend should install Java7 JRE (from the link you gave).
Thanks @jmaasing for the information. For now I will use Java 1.6, then decide further on whether or not to change it.
@jmaasing, I thumbed you up just for using code blocks. The information was spot on, too… but I was just really happy to see one of these posts without the greater than and less than symbols removed.
I thumbed you up just for using code blocks. :) ...
:D