Showing posts with label method. Show all posts
Showing posts with label method. Show all posts

Friday, 28 October 2011

Sun Certified Java Programmer (SCJP)

Declaring classes, variables, and methods


Now let's look at ways we can modify classes, methods, and variables. There are two kinds of modifiers -- access modifiers and non-access modifiers. The access modifiers allow us to restrict access or provide more access to our code.

Class modifiers


The access modifiers available are public, private, and protected. However, a top-level class can have only public and default access levels. If no access modifier is specified, the class will have default access. Only classes within the same package can see a class with