# 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:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Darkar25](https://avatars.discourse-cdn.com/v4/letter/d/ecccb3/32.png) [@Darkar25](https://discourse.processing.org/u/Darkar25)\
**Post date:** [September 13, 2019, 5:23am UTC](https://discourse.processing.org/t/thread-inside-class/13959/1 "2019-09-13T05:23:52Z")

</div>

How can i run thread inside class?when im trying for example

```auto
class test {
public test() {
thread("method123");
}
public void method123() {
println("123");
}
}

```

that will not work…it says that there is no public method method123();

---

<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…
