Writing a void as a parameter : <p>(I'm a bit new to programming so if this doesn't make sense just say so)</p>

<p>Let's say that a method takes in a void as parameter. Ex: </p>

<pre><code>method(anotherMethod);
</code></pre>

<p>and I want to write the void inside of the brackets rather than writing the void and putting the name inside so rather than </p>

<pre><code>void theVoid() {
    doSomethingHere;
}
</code></pre>

<p>and then calling it like</p>

<pre><code>method(theVoid());
</code></pre>

<p>I wanted to do</p>

<pre><code>method({ doSomethingHere; })
</code></pre>

<p>directly, is it possible to do so?</p>
