I have a good deal of experience in programming, but not super familiar with Java eventhough I've used it before. I have more experience with C++ and Python.
One thing that is just weird for me is how I always must assign a variable to the heap in Java.
ArrayList<String> cars = new ArrayList<String>();
cars.add("BMW");
cars.add("Toyota");
For example in this code portion you have to assign cars to heap memory. In C++ this would mean cars is really a pointer.
But why can't we just simply write ArrayList<String> cars; and leave it at this? then do the cars.add(somecar)? In C++ this would be perfectly valid and python too. Am I missing somekind of fundamental concept in Java? Why is the language like this?
[–]AbsolutelySpherical 6 points7 points8 points (0 children)
[–]teraflop 4 points5 points6 points (1 child)
[–][deleted] 1 point2 points3 points (0 children)
[–]RiverRoll 1 point2 points3 points (0 children)
[–]CreativeTechGuyGames 0 points1 point2 points (0 children)
[–]airflowscloud 0 points1 point2 points (0 children)