This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes how to use api Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "how to use api" Watch "how to use api" New topic

how to use api

laks subramanian

Joined: Feb 05, 2002
Posts: 17
Can somebody illustrate the use of API and how one will use it.
thanks in advance
Sigfred Zamo
Ranch Hand

Joined: Mar 04, 2002
Posts: 44
If you are referring to the Sun�s API doc, go to (J2SE 1.4):
There you have all the classes and interfaces in alphabetical order, you can access them along the the frames placed at the left side.
�Is this the info u need?

Sigfred Zamo<br />Software Development<p><a href="" target="_blank" rel="nofollow">My page</a>
Cindy Glass
"The Hood"

Joined: Sep 29, 2000
Posts: 8521
Well - there is some confusion in terminology here. We often refer to the Sun documentation of the API as the API. That is used to read up on what stuff is available from Sun to be used by us folks out here.
Of course TECHNICALLY the API is the code itself. It is that portion of the code that is public, and therefore available to be used by other classes. It is the fields and methods that OUR classes can use to interact with THEIR classes. Their code also contains encapsulated stuff that they do NOT provide access to, so that portion of the code is not part of the "interface" to their code.

"JavaRanch, where the deer and the Certified play" - David O'Meara
laks subramanian

Joined: Feb 05, 2002
Posts: 17
thanks cindy and sigfred, but an example would be highly appreciated(if possible).
Cindy Glass
"The Hood"

Joined: Sep 29, 2000
Posts: 8521
An example of WHAT?
You just READ the thing, and then you can use anything of the methods or Fields that it talks about.
For instance if you go to the Integer class (a wrapper class for ints), it shows you all of the methods that Integer types can use.
One of those methods is a static method named parseInt(String s).

public static int parseInt(String s)
throws NumberFormatException
Parses the string argument as a signed decimal integer. The characters in the string must all be decimal digits, except that the first character may be an ASCII minus sign '-' ('\u002D') to indicate a negative value. The resulting integer value is returned, exactly as if the argument and the radix 10 were given as arguments to the parseInt(java.lang.String, int) method.
s - a String containing the int representation to be parsed
the integer value represented by the argument in decimal.
NumberFormatException - if the string does not contain a parsable integer.

After reading that I know that I can do
String myString = "10";
int i = Integer.parseInt(myString);
and i now holds the int value 10.
[ April 16, 2002: Message edited by: Cindy Glass ]
laks subramanian

Joined: Feb 05, 2002
Posts: 17
Thanks Cindy, I got it.
Consider Paul's rocket mass heater.
subject: how to use api
Similar Threads
Creating new JFrame on click of JButton
Reflection API
sun's coffee break & saaj
compile error
which version of java supports audio?