954,536 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

How to learn the Java API?

Hello to everyone,

I am new to this forum as I am new to Java.

I would like to know if anyone has come up with a method that helps in learning the huge collection of classes of the Java API.

I know that question is not easy to answer. I just wanted to know how others think about this subject.

Thanks a lot for all your answers!

t@sos
Newbie Poster
5 posts since Apr 2010
Reputation Points: 11
Solved Threads: 1
 
moutanna
Posting Whiz
387 posts since Oct 2009
Reputation Points: 16
Solved Threads: 58
 

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
Team Colleague
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
Team Colleague
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
Moderator
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
Moderator
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
Team Colleague
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
Moderator
6,373 posts since Apr 2008
Reputation Points: 2,130
Solved Threads: 1,073
 

Thank you all for taking the time to answer my question!

I believe you are all right. It's impossible to learn this API by heart.

I guess, given a certain project/task, a combination of Google Search
and the Java API docs is what it takes to become a good Java
programmer.

Thanks again for all your help!

t@sos
Newbie Poster
5 posts since Apr 2010
Reputation Points: 11
Solved Threads: 1
 

I remember browsing through the API and finding a Robot class and it looked cool so I clicked on it and I was amazed that there was an object that let you control the mouse movement on the screen xD

So much crazy stuff to do with the API ^^

kvass
Junior Poster
168 posts since Aug 2009
Reputation Points: 85
Solved Threads: 21
 

Absolute agreement is what i share with party who said one can not
actually know all the API Documentation by heart, to me it is provided for all
programmers just like the dictionaries/encyclopedias that are provided for all as reference books, so i think the best bet is to make use of it check for methods
one will be needing and i belief by so doing one will go a long way to learn a lot depending on how frequent coding is

gyno
Light Poster
27 posts since Sep 2009
Reputation Points: 6
Solved Threads: 0
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: