0

hello, everybody....
i am new to java programming........so my question may be childish
i want to ask that.....in java all methods and variables are public...
by default(opposite to c++).so why we are writing public static void main(String args[]).main method can be accesed from anywhere
even if i dont write public bcoz it is by default public

2
Contributors
2
Replies
3
Views
10 Years
Discussion Span
Last Post by debargha
0

Not quite. The default access modifier makes things public only to the same package. Any class in another package will not be able to access the methods/members.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.