# Thread inside class

**URL:** <https://discourse.processing.org/t/thread-inside-class/13959>\
**Category:** Coding Questions\
**Created:** [September 13, 2019, 5:23am UTC](https://discourse.processing.org/t/thread-inside-class/13959 "2019-09-13T05:23:52Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![GoToLoop](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/gotoloop/32/86_2.png) [@GoToLoop](https://discourse.processing.org/u/GoToLoop)\
**Post date:** [September 13, 2019, 5:55am UTC](https://discourse.processing.org/t/thread-inside-class/13959/2 "2019-09-13T05:55:25Z")

</div>

> [@How can I use Thread() with functions that has inputs](https://discourse.processing.org/t/how-can-i-use-thread-with-functions-that-has-inputs/12964/2):
>
> You can’t, b/c its signature is parameterless & void. no_entry Instead, you can create a class which extends Thread: thread[Docs.Oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Thread.html](http://Docs.Oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Thread.html) /\*\* \* Threaded Method (v1.0.1) \* GoToLoop (2019/Jan/) \* \* https://Discourse.Processing.org/t/ \* how-can-i-use-thread-with-functions-that-has-inputs/12964/2 \*/ void setup() { noLoop(); } void draw() { background((color) random(#000000)); } void mousePressed() { new ThreadedMetho…

---

_[View the full topic](https://discourse.processing.org/t/thread-inside-class/13959)._
