• Post Reply Bookmark Topic Watch Topic
  • New Topic

Very Basic Question  RSS feed

 
Ranch Hand
Posts: 3830
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
package : group of classes example util,io etc

what exactly API ?

thanks .
 
Ranch Hand
Posts: 195
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I assume that you are asking the meaning of the term "API".

Well, in a simple way, I would define an API as a set of available classes (and even a set of packages) that a programmer would use (and/or extend) to develop his/her own application. API stands for "Application Programming Interface". You would use or extend the classes that are included in the software "box" that is provided to you to solve your own application problems.

Lets say you are trying to develop an application that simulates a new type of Data structure that you have just invented (!!). You would work with the Collection interfaces to extend them and use (probably) a few of the existing data structures that Java provides (within the util package) and create your own classes to represent this new data structure.

Does this make things clear or you still have a doubt?
 
ankur rathi
Ranch Hand
Posts: 3830
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It means API are the group of package ...

like JDBC API contains sql package etc ...

It just one more classification for making easy communication ... at programming level we dont deal with API , we deal with package ( we import package .. )

am i right ?

thanks .
 
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

at programming level we dont deal with API

No, that is preciscely where we do deal with APIs. The keyword in API is Interface. An API basically defines the routes you can take to programmatically interact with an application (application in this sense is a little odd - since you might not think of the JDK for example as an application).

Think about a Graphical User Interface - its basically a method of interacting with an application via easlily understood concepts (clicking buttons, typing text, using scrollbars etc.) An API is just a lower level interface - the only way to interact is via a program you might write which uses the methods and classes defined by the API.

A package (since you specifically mention this) is nothing more than an organizational structure for a set of classes. It forms part of an API - so yes in a specific class we don't deal with the entire API at once, just the part of it which interests us, and that is contained in a package (or group of packages).
 
Ranch Hand
Posts: 1272
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
We also tend to use "API" when we mean "API documentation".

You must get comfortable using the Java API to be successful in Java. I found it hard at first, it's like reading a book that's all index and no chapters, but it's more definitive than even the source code because Sun can change the source code of a library program at will but they are very careful to protect existing programs from failure when they change the API.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!