Can a class which implements interface can have void main function? | Selenium Training|Java|WebDriver|TestNG|Frameworks|Videos
10% July Month Discount Avail now

Selenium Training Forum

Can a class which implements interface can have void main function?

S
Sangeeta Bahrani Post on 12/06/2019

Why it is showing error?

package Default;

public class Cat implements Animal {


public void Cat() {
public void main aguyhd()
{

}
}

@Override
public void run() {
// TODO Auto-generated method stub
System.out.println("Cat running");
}
@Override
public void move() {
// TODO Auto-generated method stub
System.out.println("Cat moving");
}

}

S

Instructor

Support Team Reply on 12/06/2019

The error is on the below line,

public void main aguyhd()

you can use either main() or aguyhd() cannot use both together in the way you've used.