0% found this document useful (0 votes)
3 views2 pages

A Variable Is assigned transcript

The document explains the concept of variables in Java, detailing three types: local, instance, and static variables, along with their characteristics. It also covers the primitive data types supported in Java and their respective sizes, followed by an overview of various operators including unary and arithmetic operators. Examples are provided to illustrate the use of these operators in Java programming.

Uploaded by

moviereview914
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views2 pages

A Variable Is assigned transcript

The document explains the concept of variables in Java, detailing three types: local, instance, and static variables, along with their characteristics. It also covers the primitive data types supported in Java and their respective sizes, followed by an overview of various operators including unary and arithmetic operators. Examples are provided to illustrate the use of these operators in Java programming.

Uploaded by

moviereview914
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

A Variable Is assigned.

mp3
Automatically transcribed by Speechnotes on: 10/02/2025, 21:33:51
Total recording length: 00:06:16

{ 0:01 }
A variable is assigned with a data type. Variable is the name of the memory location and there are three types of
variables in Java which are local, instance and static. Let us understand local variable. A variable declared
inside the body of a method is called local variable. You can use this variable only within that particular method
and other methods in the class will not be aware of that particular variables which are used in your local class. A
local variable cannot be defined with the static keyword followed by that we have instance variable. A variable
declared inside the class but outside the body of the method is called instance variable. It is not declared as
static.

{ 0:59 }
It is called the instant variable because its value is instant specific and not shared among other instances. The
last but not the least is the static variable. A variable which can be declared as static is called static variable. It
cannot be local. You can create a single copy of static variable and share among all the instances of the class.
Memory allocation for static variable happens only once when the class is loaded in the memory. Now the next
part is the data types. The data types supported in Java programming language are int, float, double, long, short,
character, byte and boolean. Now let us also go through the size of each data type supported by Java.

{ 1:58 }
Java supports 2 bytes for integer data type, 4 bytes for flow data type, 8 bytes for double and eight bytes for long
followed by that two bytes for character type data type, 1 byte for short, one for byte and one byte for boolean.
These data types are called as primitive data types followed by variables and data types. Now let us enter into
the operators that are available in Java. The operators in a programming language are specific or special
symbols used along with the variables on numbers so as to carry out some specific operations. The various
operators available in Java are as follows.

{ 2:55 }
They are unary operator, arithmetic operator, shift operator, relational operator, bitwise operator, logical
operator, terminary operator and finally the assignment operator. We should discuss about each and every
single operator available in Java. Firstly, the unary operator. The Java unary operator requires only one operand.
The unary operators are used to perform various operations such as incrementing or decrementing a value by 1,
negating an expression, inverting the value of a boolean and many more. Now let us execute a simple example
of unary operator in Java. As you can see, this particular example is based on unary operators.

{ 4:00 }
So here I have declared a value 10 to the variable X of integer data type and now I am trying to increment the
value of X by 1 by adding the unary operator increment. This particular incrementation is called post increment.
Followed by that we have a similar increment operator which is placed before X which says it is a pre increment
operator followed by that we will try to decrement the value of X by 1 by using post decrement operator where
we will provide the decrement operator after X and similarly the same decrement operator is used before X
which says that it is a pre decrement operation.

{ 4:57 }
Now let us try to execute our program and say the output. You can see the output has been successfully
generated. Now followed by this, let us move ahead and understand the arithmetic operator. Java arithmetic
operators are used to perform addition, subtraction, multiplication and division. They act as basic mathematic
operations. Now let us see a basic example for arithmetic operators.

{ 5:36 }
You can see I have provided 2 variables that is A and BA has the value 10 and B has the value 5 S The basic
arithmetic operations that I will be performing are addition, subtraction, multiplication, division, and modulus.
So the addition symbol is carried out by plus subtraction is minus multiplication S star division S/ and modulus
S modulus symbol.
--- End of transcript ---

You might also like