As a method returns a int value we have return type as a int and if method returns nothing we use return type as a void.
If the method is not returning anything then why should we use void. I know that without giving the return type to a method it will give an error. But my question is why void if a method return nothing.
eg:
void abc()
{
stat1;
....;
}
why not
abc()
{
stat1;
....;
}
If the method is not returning anything then why should we use void. I know that without giving the return type to a method it will give an error. But my question is why void if a method return nothing.
eg:
void abc()
{
stat1;
....;
}
why not
abc()
{
stat1;
....;
}
Comment