2
I’m studying competition, and I was trying to make a code using the Semaphore, and that mistake has arisen
"the type of Processadorthread(int, Semaphore) is erroneuos"
when I tried to run.
I’m using Netbeanside, and I’d like to know what this mistake is.
Class where error occurs:
package threadsemaforo;
import java.util.concurrent.Semaphore;
public class ThreadSemaforo {
public static void main(String[] args) {
int numeroDePermicoes = 2;
int numeroDeProcessos = 6;
Semaphore semaphore = new Semaphore(numeroDePermicoes);
ProcessadorThread[] processos = new ProcessadorThread[numeroDeProcessos];
for (int i = 0; i < numeroDeProcessos; i++) {
**processos[i] = new ProcessadorThread(i, semaphore);**
processos[i].start();
}
}
}
Enter the code of the constructors of the class
ProcessadorThread
.– Renan Gomes
found the problem, was missing I implement one more class! now I managed
– renan mateus
@renanmateus please set the solution as a response and mark it as resolved. Others may benefit from this response.
– Fagner Fonseca