CSS handles the look and feel part of a web page. Using CSS the color of the text, the style of fonts, the spacing between paragraphs, how columns are sized and laid out, what background images or colors are used, layout designs, variations in display for different devices and screen sizes as well as a variety of other effects. CSS provides powerful control over the presentation of an HTML document. Most commonly, CSS is combined with the markup languages HTML or XHTML.

  1. You can define a style for each HTML element and apply it to as many Web pages as you want.
  2. You do not need to write HTML tag attributes every time. Just write one CSS rule of a tag and apply it to all the occurrences of that tag.
  3. CSS simply change the style, and all elements in all the web pages will be updated automatically.
  4. CSS using the same HTML document, different versions of a website can be presented for handheld devices such as PDAs and cell phones or for printing.
  5. Its a good idea to start using CSS in all the HTML pages to make them compatible to future browsers.

 Java is an object-oriented programming language, we have to follow the encapsulation wherein we hide the unwanted details.

Java provides entities called “Access Modifiers or access specifiers” that help us to restrict the scope or visibility of a package, class, constructor, methods, variables, or other data members. These access modifiers are also called “Visibility Specifiers”.

Access Modifiers In Java
To ensure encapsulation and reusability, these access specifiers/modifiers are an integral part of object-oriented programming.


Modifiers in Java are of two types:

#1) Access Modifiers

Access modifiers in Java allow us to set the scope or accessibility or visibility of a data member be it a field, constructor, class, or method.

#2) Non-access Modifiers

Java also provides non-access specifiers that are used with classes, variables, methods, constructors, etc. The non-access specifiers/modifiers define the behavior of the entities to the JVM.

Some of the non-access specifiers/modifiers in Java are:

  • static
  • final
  • abstract
  • transient
  • volatile
  • synchronized
  • native
    

Types Of Access Modifiers In Java

Java provides four types of access specifiers that we can use with classes and other entities.

These are:

#1) Default: Whenever a specific access level is not specified, then it is assumed to be ‘default’. The scope of the default level is within the package.

#2) Public: This is the most common access level and whenever the public access specifier is used with an entity, that particular entity is accessible throughout from within or outside the class, within or outside the package, etc.

#3) Protected: The protected access level has a scope that is within the package. A protected entity is also accessible outside the package through inherited class or child class.

#4) Private: When an entity is private, then this entity cannot be accessed outside the class. A private entity can only be accessible from within the class