The ONLY way is through extensive experience using them.
I doubt anyone knows every method and field in every class of even the core API and knows its correct usage.
And if such a person exists no doubt that knowledge is purely academic and he has no clue as to how to actually apply it to real world situations.
jwenting
duckman
8,392 posts since Nov 2004
Reputation Points: 1,662
Solved Threads: 337
The ONLY way is through extensive experience using them.
I doubt anyone knows every method and field in every class of even the core API and knows its correct usage.
And if such a person exists no doubt that knowledge is purely academic and he has no clue as to how to actually apply it to real world situations.
100% agreed. Make sure you learn concepts such as inheritance, polymorphism, interfaces, etc first - otherwise many of the methods in the Java API will not make much sense. I recommend either taking a course on Java or getting a decent beginner's book.
BestJewSinceJC
Posting Maven
2,772 posts since Sep 2008
Reputation Points: 874
Solved Threads: 354
The API is there for you to read it, not learn it by heart.
As long you know how to call methods with the right number and type of arguments and put the return value inside the right type, you are ok.
Of course that doesn't mean that for every single method you need to look at the API. With extensive use some of the methods you learn them. But If you want to do something different, you don't have to remember everything, just where to find the method that you want.
And I don't believe that anyone knows the entire API even if it is the core java. If such person existed, he wouldn't know nothing about programming, because he would have wasted all his time in learning methods by heart instead of using them.
javaAddict
Nearly a Senior Poster
3,329 posts since Dec 2007
Reputation Points: 1,014
Solved Threads: 448
I agree with the previous posters. Don't learn the API, learn to use the API JavaDoc and Google to find what you need when you need it. As you build up experience you'll get to know the most common APIs, and you'll be able to copy/paste from things you have already written and debugged for many more (so never throw away any working code you've written).
JamesCherrill
Posting Genius
6,373 posts since Apr 2008
Reputation Points: 2,130
Solved Threads: 1,073
I agree with the previous posters. Don't learn the API, learn to use the API JavaDoc and Google to find what you need when you need it. As you build up experience you'll get to know the most common APIs, and you'll be able to copy/paste from things you have already written and debugged for many more (so never throw away any working code you've written).
Somewhat agreed on both points. Unless you are exceptionally good at organization, keeping every code you write is going to take longer as far as reusability than rewriting certain things will. But in general, holding on to modular code can't hurt. And unless you know a good bit of the API, it will be substantially harder to understand the other parts.
BestJewSinceJC
Posting Maven
2,772 posts since Sep 2008
Reputation Points: 874
Solved Threads: 354
. Unless you are exceptionally good at organization, keeping every code you write is going to take longer as far as reusability than rewriting certain things will.
Yes, well, maybeevery was a bit heavy!
I always think about whether code I'm about to write has any potential for re-use and, if it seems possible, I write it as a library class for reuse. Over the years I've accumulated a real treasure-chest of useful code which, even if it's not exactly what I need, can often be extended (and thus the extensions saved for future re-use).
I'm a major fan of code reuse.
JamesCherrill
Posting Genius
6,373 posts since Apr 2008
Reputation Points: 2,130
Solved Threads: 1,073
I wonder what your (former) employers would have to say about you taking all the code you wrote for them and storing it for future use in other projects they're not getting paid for.
jwenting
duckman
8,392 posts since Nov 2004
Reputation Points: 1,662
Solved Threads: 337
I wonder what your (former) employers would have to say about you taking all the code you wrote for them and storing it for future use in other projects they're not getting paid for.
Leaving aside the exact legal nicities for the moment, all I can say is that in the >40 years since I started earning my living as a programmer it's never once come up as a problem.
Obviously I woudn't be able to re-use proprietary or trade secret algorithms etc, but the kind of code I'm talking about is generic . I also have been maybe lucky in that all my employers (except, obviously, the very first) and contracts have been smart enough to see that they gain more than they lose in terms of my productivity.
On the other hand, I've never worked for a firm of copyright lawyers, fortunately.
JamesCherrill
Posting Genius
6,373 posts since Apr 2008
Reputation Points: 2,130
Solved Threads: 1,073