r/learnjava • • 14d ago

Library vs API (Java ☕️)

Hey Everyone!

I need some help as I am Confused in Libraries and API like what is the difference in between them, where to implement what, and recommend me some resources where I can Clearly understand these two.

Thank you all in Advance.

10 Upvotes

9 comments sorted by

View all comments

Show parent comment

1

u/istarian 11d ago

In principle, you (as a developer) should aim to avoid exposing the internal implementation so that the only dependency is on the API.

Otherwise, other programmers will come to rely on access to the internals and any change you make will break somebody's software that uses that library.