Why Java cannot find my constructor?
compilation, constructor, java
Solution
delete void from signature
public ServiceResolver(int ifIndex, String serviceName, String regType, String domain) {
this.ifIndex = ifIndex;
this.serviceName = serviceName;
this.regType = regType;
this.domain = domain;
}
Problem
Well, maybe it is a stupid question, but I cannot resolve this problem. In my `ServiceBrowser` class I have this line: ``` ServiceResolver serviceResolver = new ServiceResolver(ifIndex, serviceName, regType, domain); ``` And compiler complains about it. It says: ``` cannot find symbol symbol : constructor ServiceResolver(int,java.lang.String,java.lang.String,java.lang.String) ``` This is strange, because I do have a constructor in the ServiceResolver: ``` public void ServiceResolver(int ifIndex, String serviceName, String regType, String domain) { this.ifIndex = ifIndex; this.serviceName = serviceName; this.regType = regType; this.domain = domain; } ``` ADDED: I removed `void` from the constructor and it works! Why?