help! what does public keyword do in java and difference b/w ( public class mycalss{...} and class myclass{..} ) | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

help! what does public keyword do in java and difference b/w ( public class mycalss{...} and class myclass{..} )

i confused the public keyword

18th Dec 2019, 3:59 PM
A̳X̳M̳E̳D̳ ̳Y̳A̳R̳E̳
A̳X̳M̳E̳D̳ ̳Y̳A̳R̳E̳ - avatar
8 Answers
18th Dec 2019, 4:15 PM
Kevin ★
+ 4
18th Dec 2019, 4:45 PM
A̳X̳M̳E̳D̳ ̳Y̳A̳R̳E̳
A̳X̳M̳E̳D̳ ̳Y̳A̳R̳E̳ - avatar
+ 4
The default access is package private.
19th Dec 2019, 6:58 AM
Sonic
Sonic - avatar
19th Dec 2019, 7:24 AM
Sonic
Sonic - avatar
+ 3
Kevin Star thanks
18th Dec 2019, 4:43 PM
A̳X̳M̳E̳D̳ ̳Y̳A̳R̳E̳
A̳X̳M̳E̳D̳ ̳Y̳A̳R̳E̳ - avatar
+ 3
18th Dec 2019, 9:44 PM
A̳X̳M̳E̳D̳ ̳Y̳A̳R̳E̳
A̳X̳M̳E̳D̳ ̳Y̳A̳R̳E̳ - avatar
+ 2
there are 3 types of access specifiers in java-Public,Private and Protected Public makes a class' data public while Protected is used when you only want to see your class's contents
18th Dec 2019, 4:17 PM
Naman Pandey
Naman Pandey - avatar
+ 2
Sonic thanks
19th Dec 2019, 7:23 AM
A̳X̳M̳E̳D̳ ̳Y̳A̳R̳E̳
A̳X̳M̳E̳D̳ ̳Y̳A̳R̳E̳ - avatar