Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to interpet the Java API's

 
Serapio Perez III
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Does anyone know of a good tutorial on how to read and interpet the Java docs?
Everything I'm doing is telling me that I can make some real strides if someone could just expline to me how to interpet them.
Thanks
 
Ron Newman
Ranch Hand
Posts: 1056
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please be more specific. What are you having trouble understanding?
 
Serapio Perez III
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok, when I look at the java API I really don't have any idea what any of it means.
1) how does one interpet them (read them)?
Example: I look up Applet then say I want my applet to play a sound. I found this:
public AudioClip getAudioClip(URL´┐Żurl, String name)
so do I just enter that method after importing Applet? With the two variables (URL http://www.whatever.com, String tune.wav)?
And then when the applet opens up it plays the sound?
I did try this and the first thing I encountered was that I had to use the escape characters for the forward slashes in the URL, but it still didn't compile.
If I could just make some sense of things like this I'm sure it would help.
Thanks
 
Marilyn de Queiroz
Sheriff
Posts: 9066
12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

It seems that if you want to play a sound that you would look for a method named play(). If you put the String with the file name in the same directory as the applet, this should play for you.
 
Marilyn de Queiroz
Sheriff
Posts: 9066
12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So do I just enter that method after importing Applet?

With the two variables (URL new URL("http://www.whatever.com"), String "tune.wav")?
String has to be in String format. URL has to be in URL format (click on the hyperlink from the method you're in to URL and it will tell you how to construct a URL).

Escaping backslashes (and other characters) is not in the API. It is basic Java. I suggest you look at the Java Tutorial for some basic concepts.
[ September 03, 2002: Message edited by: Marilyn de Queiroz ]
 
Dirk Schreckmann
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This isn't a super easy solution, but it's a very practical and reasonable approach to learning how to program in Java. Reading between the lines of your posts, that's what I'm understanding you are wanting to do.
Hit the free tutorials available on-line.
The short list of free Java tutorials that I have found useful include:
  • Sun's Java Tutorial
  • Introduction to Computer Science using Java by Bradley Kjell
  • Introduction to Programming Using Java by David J. Eck
  • and Dick Baldwin's Java Programming Tutorials

  • The API documentation is going to specify what methods and properties the classes have and how (generally) they can be used. If you're looking to better understand the life cycle of an Applet (and what and when methods are invoked automatically by the browser), then do read the API documentation, read Sun's Java Tutorial on the subject, and, of course, ask questions here.
     
    Dirk Schreckmann
    Sheriff
    Posts: 7023
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    I just noticed that part of Sun's Applet Tutorial is called Playing Sounds. Perhaps it has some information that you'd find useful.
     
    Gregg Bolinger
    Ranch Hand
    Posts: 15304
    6
    Chrome IntelliJ IDE Mac OS X
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Don't feel bad about having problems with the API Serapio. I felt the same as you did/do. But what I finally figured out, well before the luxury of JavaRanch, is that the API is not a tutorial.
    To me, the API was not helpful at all until I understood the JAVA language. Then all of a sudden, everything made sense. Well, almost everything. I still look at the API sometimes and think "What is Sun thinking?"
    Just didn't want you to think you were alone.
     
    • Post Reply
    • Bookmark Topic Watch Topic
    • New Topic