nus-cs2103-AY2324S1 / forum

10 stars 0 forks source link

Question on practice exam part 2 #549

Closed Elijah5399 closed 9 months ago

Elijah5399 commented 9 months ago

Hi, I would like to ask why the two update methods are shown as public in the class diagram when no access modifiers were specified in the code.telegram-cloud-photo-size-5-6280732257392113360-ytelegram-cloud-photo-size-5-6280732257392113362-y

TeeRenJing commented 9 months ago

https://docs.oracle.com/javase/tutorial/java/IandI/interfaceDef.html#:~:text=All%20abstract%2C%20default%2C%20and%20static,you%20can%20omit%20these%20modifiers.

It seems that "All abstract, default, and static methods in an interface are implicitly public, so you can omit the public modifier."

Hence the plus symbol for the visibility of public.