我知道 API 是一组规则和协议。任何人都可以用示例向我解释什么是 Java API 及其功能...
您可以在这里找到 Java APIhttp://download.oracle.com/javase/6/docs/api/index.html http://download.oracle.com/javase/6/docs/api/index.html
您可以说它是 Java 库,您可以像构建软件一样使用它,这样可以加快您的开发速度。
例如:
ArrayList 是 API 中的 gazilion 类之一。
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 :)
如果您想知道还可以使用 ArrayList 做什么,您应该查看 API 或在输入 myList 时。 CTRL + SPACE 将为您提供所有可用的功能:)
祝你好运!
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)