what is Java API?
I k开发者_如何学编程now API is a set of rules and protocols.can anyone explain me with example what is a Java API and its functionality...
You can find Java API here http://download.oracle.com/javase/6/docs/api/index.html
You could say it is the Java library and you can use it like building blocks for your software and that way speed up your development.
For example:
ArrayList is one of the gazilion classes in the API.
import java.util.ArrayList; // We say the old mighty compiler that we want to use this class
// we create an ArrayList object called myList that will hold objects of type Beer
ArrayList<Beer> myList = new ArrayList<Beer>();
Beer b = new Beer();
myList.add(b); // the class ArrayList has a function add, that adds an object(a Beer);
myList.size(); // will give you the size of the ArrayList.
myList.remove(b); // will remove our beloved Beer :)
If you want to know what else can you do with the ArrayList you should check out the API or when typing myList. CTRL + SPACE will give you all the functions avaible :)
Good luck!
Exactly what you described, just for the Java language.
Java API is a set of libraries that are found in the standard Java distribution, and is called the JRE (Java Runtime). So, every time you use something like Integer
as a class for representing integers, you're using Java's API.
But since Java is so broad, and boundaries between various distributions (Java SE, Java EE, Java ME) aren't always clear at first sight, the terminology "Java API" might be misleading.
So, treat it as the way you communicate your code to Java's libraries.
general api explanation
JAVA API
In a nutshell, the API is used from a user point of view as the reference which classes and methods are available in this specific language
The JAVA API is a collection of classes and functions that can be used to create programs....
A programming language is a general term for a computer-program language.....while API is the technical term for the actual set of features implemented using functions and classes...
The Java API is implemented using the JAVA JDK(Java Development Kit) from Oracle/Sun.
In simple, Java APIs are integrated pieces of software that come with JDKs. APIs in Java provides the interface between two different applications and establish communication. I suggest you to check the following vedio which explains deeply.
https://www.youtube.com/watch?v=u4tw-cIJFuo
精彩评论