Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

delay()  RSS feed

 
Marie Day
Greenhorn
Posts: 29
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm looking at some code online, and there's this function:
delay(1000 * 4);
It doesn't appear to be associated with an object.
One of the objects in the code extends Thread, which doesn't have a delay() function.
At any rate, this line is outside of any class code.
I've searched for a java function index on the internet and haven't been able to
find one. Googling the function itself doesn't bring up anything.

Is this a static method? Where's the documentation on it?
 
Mike. J. Thompson
Bartender
Posts: 689
17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you post the code or a link to where you saw it? There isn't enough information there to tell you what it is.
 
Mike. J. Thompson
Bartender
Posts: 689
17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And what do you mean by outside of any class code? You can't write code outside of classes in Java.
 
Marie Day
Greenhorn
Posts: 29
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mike. J. Thompson wrote:Can you post the code or a link to where you saw it? There isn't enough information there to tell you what it is.


Here's the link to the page. It's in the first listing.

http://www.drdobbs.com/jvm/music-components-in-java-creating-oscill/230500178?pgno=2
 
Marie Day
Greenhorn
Posts: 29
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mike. J. Thompson wrote:And what do you mean by outside of any class code? You can't write code outside of classes in Java.


Based on that statement, I looked up Object, and didn't see a delay method there. Could you tell me what class this line of code belongs to...
 
Marie Day
Greenhorn
Posts: 29
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mike. J. Thompson wrote:And what do you mean by outside of any class code? You can't write code outside of classes in Java.


I meant it doesn't seem to be part of the code that defines a class, or inherited from a class that's being extended.
 
Mike. J. Thompson
Bartender
Posts: 689
17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've read the code, and the incomplete code snippet does not make it clear where the delay method is defined. I don't know if that is meant to be pseudo code or if there really is a delay method in their library, but I don't think you'll find it in any standard Java classes.

A likely implementation (if its a real method) will be to call Thread.sleep(long).
 
Marie Day
Greenhorn
Posts: 29
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mike. J. Thompson wrote:I've read the code, and the incomplete code snippet does not make it clear where the delay method is defined. I don't know if that is meant to be pseudo code or if there really is a delay method in their library, but I don't think you'll find it in any standard Java classes.

A likely implementation (if its a real method) will be to call Thread.sleep(long).


Thank you. He does offer a jar file containing all the code for all the sound synthesis components in the article series. The answer is most likely in there.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!