This content originally appeared on DEV Community and was authored by Sri Raam
- Objects
- Types of Variables
- Comments
- Keywords
OBJECTS
- Variables are the state of the objects, i.e the entities that store the numeric units of the Real-time objects.
- Methods are the behaviour of the object, i.e the functions done by the object.
TYPES OF VARIABLES
- The variables in Java can be classified into two types based on their scope, namely: 1. Global Variables, 2.Local Variables
- Global Variables -Global Variables can be used throughout the program.
- Mapping a literal to a variable is known as assigning or initialising. e.g,
int pixel=10;
Introducing a variable without assigning a value is known as declaring. e.g,
[int a;](url)
Local Variable
A Local Variable can be declared and accessed only within a method.
COMMENTS
Comments are blocks of code that are hidden from the end user and are used for the programmer’s understanding.
- Single Line Comment: // is used for comments that end within a line.
- Multi-Line Comment: /** and /** are used for comments that take up multiple lines, and the comments are entered within /** and **/.
KEYWORDS
- Keywords are words that perform certain significant functions in the code.
- Keywords are also known as Reserved words.
- e.g, new, int, float, byte, short, long, double, boolean, char, short, class, package.
This content originally appeared on DEV Community and was authored by Sri Raam