(b)  Explain followings in context of java, with the help of examples.

(i)  Class and objects

(ii)  Abstraction and encapsulation

(iii)  Application program and applet program

  • Class and object

A class is a blueprint that describes characteristics and functions of entity.. For example, the class Dog would consist of traits shared by all dogs. A class is collection of the properties and methods are called members. Object is an instance of class.

Data abstraction: – it is a process that provides only essential features by hiding its background details. A data abstraction is a simple view of an object that includes required features and hides the unnecessary details.

  •  Data abstraction & Data encapsulation

it is a process that provides only essential features by hiding its background details. A data abstraction is a simple view of an object that includes required features and hides the unnecessary details. it is a mechanism of bundling the data, and the functions that use them and data abstraction is a mechanism of exposing only the interfaces and hiding the implementation details from the user.

  • Applet vs Application program

Java Application:

  • A java application is a stand-alone program. This means it can be run by itself.
  • It cannot access from web browser.
  • It is run by JVM.
  • It can access on local machine on which program is reside.

Applet

  • Applet cannot run as independent program.
  • Applet program can run from within a web browser or similar java enabled application such as an applet viewer
  • Java applets are included in HTML pages using <applet> tag.
  • Applet communicates with server only.
  • Applets are not allowed to read or write to files on the local system.
 

Leave a Reply