Computer Science Canada You haven't learned Java if... |
Author: | wtd [ Wed Dec 17, 2008 1:20 pm ] |
Post subject: | You haven't learned Java if... |
You haven't succeeded in learning Java if... This is aimed at students taking introductory programming classes in high school. Yes, I realize the quality of instruction may vary, but you are not limited to what your teacher provides. Try reading my Introduction to Java, for instance.
|
Author: | S_Grimm [ Wed Dec 17, 2008 7:48 pm ] |
Post subject: | RE:You haven\'t learned Java if... |
lol. I guess I don;t know Java then. I use still arrays for things that require a set amount of variables. BTW: Is there a tutorial on Collections around here? |
Author: | andrew. [ Tue Dec 30, 2008 8:09 pm ] |
Post subject: | RE:You haven\'t learned Java if... |
I know everything except the last two. And also, is there a Collections tutorial? Someone should make it. |
Author: | wtd [ Wed Dec 31, 2008 12:26 am ] |
Post subject: | RE:You haven\'t learned Java if... |
I talk about both subjects in my Introduction to Java, which is available on the wiki. |
Author: | Zren [ Sun Nov 21, 2010 5:43 pm ] |
Post subject: | RE:You haven\'t learned Java if... |
Ignoring the spam above. Just wondering if by learning abstract classes, you'd clear the last thing on that list? I've never made an Interface, but they seem slightly similar. |
Author: | SmokeMonster [ Sun Nov 21, 2010 11:41 pm ] |
Post subject: | Re: RE:You haven\'t learned Java if... |
Zren @ Sun Nov 21, 2010 5:43 pm wrote: Ignoring the spam above. Just wondering if by learning abstract classes, you'd clear the last thing on that list? I've never made an Interface, but they seem slightly similar.
I'd say so since Abstract Class is pretty much a superset of an interface. |
Author: | Barbarrosa [ Sun Nov 21, 2010 11:58 pm ] |
Post subject: | Re: You haven't learned Java if... |
@Zren: Nope, you don't clear that last one by using abstract classes. I'd add abstract classes to the list, although implementing a child class for an abstract collection parent class could certainly help in that learning process. You can't do as much in an interface as you can in an abstract class, not NEARLY as much. They're more flexible, though, in some ways. @wtd: Are there particular situations where arrays perform better than other ways to store lists of data, or are they pretty much always trumped by the Collections classes? I read somewhere that it takes up less memory to make an empty array than an object, so I thought they might have the advantage of allocating less memory than a collection class. I understand that the collection classes (e.g., the HashMap) provide valuable ways of storing large amounts of data, which are often more practical than an array for both data retrieval and usage. |
Author: | TokenHerbz [ Sat Mar 17, 2012 9:18 pm ] |
Post subject: | RE:You haven\'t learned Java if... |
I am curious to know these answers and would also like to see a link to a collections tutorial. |
Author: | ProgrammingFun [ Sat Mar 17, 2012 10:17 pm ] |
Post subject: | Re: RE:You haven\'t learned Java if... |
TokenHerbz @ Sat Mar 17, 2012 9:18 pm wrote: I am curious to know these answers and would also like to see a link to a collections tutorial.
Same here... I have done everything except the last two... |
Author: | DemonWasp [ Sat Mar 17, 2012 10:18 pm ] |
Post subject: | RE:You haven\'t learned Java if... |
To clear up a few things from the last several posts: 1. Abstract classes and interfaces are similar in some respects (can't instantiate either), but critically different otherwise. You can implement several different interfaces, but you can only ever extend one class (nearly all classes extend another class, even without the 'extends' clause: they extend Object. Interfaces cannot contain implementation details, only the critical bits of public API. They are both useful in different contexts. 2. Arrays perform (slightly) better for random-access operations than ArrayLists. They are also the fastest sequential-access data structure (though ArrayLists are again very close). They are terrible for any operations where the size changes. Most Java programmers, even when they know the initial size beforehand and don't plan to add or remove objects, will use List<Type> over Type[]. Doing so provides much more flexibility in case anything needs to be changed later. In addition, nearly all Java libraries prefer to use Lists over arrays, so most data-passing is done in Collections. 3. I couldn't find wtd's Introduction to Java in 30 seconds, so I gave up. Try this instead: http://docs.oracle.com/javase/tutorial/collections/ |