+ 1

Can any one give an example for how and where to use API functions. Also an example program depicting its functionality.

23rd Sep 2016, 11:43 AM
Tabres Basha
Tabres Basha - avatar
2 Answers
+ 1
https://docs.oracle.com/javase/7/docs/api/ is a very useful resource. *If you know how to use the Scanner class, Strings class, or Math class, those are all examples. Graphics class *This class allows you to render shapes, strings, and images. Example program: import java.awt.Graphics; public class ExampleClass { public void drawRectangle(Graphics g) { //makes the rectangle green g.setColor(Color.GREEN); /*fills the rectangle green *parameters: (x, y, width, height) */ g.fillRect (10, 10, 100, 100); } } Hope this helps!
31st Oct 2016, 2:26 AM
Scylla
Scylla - avatar
+ 1
In my previous answer, some examples of its pre-written functions include: setColor(), fillRect(), drawRect(), drawOval(), drawString(), drawImage(), and many more. More information can be found on the website I provided on my previous answer.
31st Oct 2016, 2:29 AM
Scylla
Scylla - avatar