0

Is it necessary to mention public for a method in interface?

6th Oct 2019, 3:58 AM
Badrinath Madhivanan
Badrinath Madhivanan - avatar
6 Antworten
+ 1
Generally no...? which language?
6th Oct 2019, 4:10 AM
Peter David Carter
Peter David Carter - avatar
+ 1
Hhhmmmmm, from the info I can find: seems they are public by default so you *shouldn't* have to, but all examples show public explicitly defined, so perhaps a conversation is to explicitly declare... Simple way to find out: what happens if you don't?
6th Oct 2019, 4:17 AM
Peter David Carter
Peter David Carter - avatar
+ 1
Taste ah, so public is required in Java if you want it to be accessible outside the package? In TypeScript it's not even an option as it is inferred anyway...
6th Oct 2019, 4:41 AM
Peter David Carter
Peter David Carter - avatar
0
Java
6th Oct 2019, 4:12 AM
Badrinath Madhivanan
Badrinath Madhivanan - avatar
0
the default is package level scope, not public. the method will be only accessible from the same package.
6th Oct 2019, 4:40 AM
Taste
Taste - avatar
0
aah it seems that i really missed the point,
6th Oct 2019, 10:30 AM
Taste
Taste - avatar