Im getting Exception in thread "main" java.lang.Error: Unresolved compilation.
What am I doing wrong?
public class idsbasedagent{
JDCaptor captor ;
public idsbasedagent(){
captor=new JDCaptor();
}
public static void main(String[] args){
System.out.println("؟ھت¼×¥°ü");
idsbasedagent agent=new idsbasedagent();
agent.capturesFromDevice();
}
}
Exception in thread "main":
java.lang.Error: Unresolved compilation problem:
The method
capturesFromDevice()
is undefined for the typeidsbasedagent
atidsbasedagent.main(idsbasedagent.java:11)
The main method is calling method "capturesFromDevice" on the "agent" object of type "idsbasedagent". However , your class "idsbasedagent" doesn't have the method "capturesFromDevice()" defined in it. So you need to define that method for eg:
public class idsbasedagent{
JDCaptor captor ;
public idsbasedagent(){
//...
}
public void captureFromDevice() {
//implementation
}
}
Or it could be that "captureFromDevice" is a method of JDCaptor class. In which case, you would need to call that method on the the agent's "captor" member variable like so:
agent.captor.captureFromDevice()
Sidenote: With regards to class names, the java coding convention dictates that class/interfaces should be capitalised. Have a look at this: http://www.oracle.com/technetwork/java/codeconventions-135099.html
The rest of the convention topics can be found here: http://www.oracle.com/technetwork/java/codeconvtoc-136057.html
Hope that helps.
The Class idsbasedagent
is expected to have a method 'capturesFromDevice' if you want its instances to be able to call it.
You cannot call a method which has not been defined.
public class idsbasedagent{
JDCaptor captor ;
public idsbasedagent(){
captor=new JDCaptor();
}
public void capturesFromDevice(){
//Method action here
}
public static void main(String[] args){
System.out.println("؟ھت¼×¥°ü");
idsbasedagent agent=new idsbasedagent();
agent.capturesFromDevice();
}
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.