Java – Basic Syntax

A basic Java program can be broken down into several constructs and elements. Typically, it can be characterized as a collection of objects, which communicate with each other by calling each other’s routines. The basic definitions of objects and classes are given below:

  • Class

A class can be described as a blueprint that portrays the practices/expresses all the behaviors and states of its objects.

  • Object

Objects are characterized by two components namely, methods and attributes or variables. For instance, if you consider the example of a puppy, then it has the following attributes or states: name, color and breed. In addition, it also has the following behaviours, which include woofing, wagging and consuming. Any object is nothing but an instance of a class.

  • Instance Variables

Each object has its set of variables. An object’s state is made by the qualities alloted to these variables during program execution.

  • Methods

A method is the definition of a method. Moreover, a class can contain numerous methods. It is in these methods that behaviours like where the rationales are composed, information is controlled and all the activities are executed.


For any query or issue, feel free to discuss on http://discuss.eduguru.in