Re: Please help! Java ARRAYS
static List<Car> cars = new ArrayList<Car>();
Or?
Car[] cars;
Re: Please help! Java ARRAYS
Thanks for replying...
I tried that and it returns an error message " cannot find symbole - class list"
Re: Please help! Java ARRAYS
Re: Please help! Java ARRAYS
How? Sorry, I am very new to Java.
Re: Please help! Java ARRAYS
You cannot use lists from the collection framework without importing the into the program. Just "import java.util.*; or just import ArrayList. Check out some tutorials on using arrays. Use google.
Re: Please help! Java ARRAYS
Quote:
Originally Posted by
imsuperman05
static List<Car> cars = new ArrayList<Car>();
Or?
Car[] cars;
http://www.javaprogrammingforums.com...n-feeding.html
Re: Please help! Java ARRAYS
Quote:
Originally Posted by
imsuperman05
static List<Car> cars = new ArrayList<Car>();
Or?
Car[] cars;
Psht... people need to get up-to-date with Java 7
= new ArrayList<>(); =))
Re: Please help! Java ARRAYS
Can you share what has been changed in the Java Collection Framework's List instead of rolling on the floor while others are drowning? Thanks
For those who do not know the recent changes to the collection framework, you can read it online or remember this next time you create objects using the collection
For example,
Instead of saying List<String> lists = new ArrayList<String>()
lists.add("stuff");
You can do it this way like in Ruby language
List<String> lists = ["stuff"];
Anyway, you might want to read more about it because some of the updates might not be as commonly used as you might think.
Re: Please help! Java ARRAYS
Quote:
Originally Posted by
Mr.777
Sorry, wasn't aware. I won't spoon-feed anymore.
Re: Please help! Java ARRAYS
Quote:
Originally Posted by
newbie
Psht... people need to get up-to-date with Java 7
= new ArrayList<>(); =))
Oh wow, didn't know that lol. Haven't touched Java 7 in a while, just opened on Eclipse 4.1 hehe.
Re: Please help! Java ARRAYS
Take into account that using "new" keyboard is very important since it is the way in which Java allocates variables efficiently in computer's memory. In other words: not using this declaration first : ArrayList<String> lists = new ArrayList<String>()
could bring you issues in your program.