posted 20 years ago
Hello
Is the public keyword the regarded as a default when defining methods. I have a class that contains only methods that I wish to call from another file/class. I have methods as shown below :
int getClose() {
return this.closeTime ;
}
void setClose(int closeTime) {
this.closeTime = closeTime ;
}
This compiles and runs fine. But I have also seen that if you declare the methods as public int getClose() and public void setClose(int closeTime), it also works fine. The only difference is that in the latter I have added the keyword public to the method definition.
So, because both versions work fine, can I assume that the keyword public is a default definition.
Thanks In Advance,
Rajesh