Assignment Operators in Java - Java Tutorial 20

preview_player
Показать описание
Notes for You:: Assignment Operators in Java - Java Tutorial 20

Assignment Operator ( = ):
- is used to assign a value to a variable or a constant.

Short Hand Assignment (SHA) Operators:
- allow us to write compact or condensed form assignment statements.

AA (Arithmetic Assignment) operators:
+=
-=
*=
/=
%=

Example code:
package assignmentoperatorsdemo;

public class AssignmentOperatorsDemo
{
public static void main(String[] args)
{
final float PI = 3.142f;

int a = 0;

a = 10;

a += 10; // a = a + 10;

a -= 10; // a = a - 10;

a *= 2; // a = a * 2;

a /= 2; // a = a / 2;

a %= 2; // a = a % 2;

}
}

=========================================

Follow the link for next video:

Follow the link for previous video:

=========================================

Java Tutorials Playlist:-

=========================================
Watch My Other Useful Tutorials:-

C++ Tutorials Playlist:

C# Tutorials Playlist:-

C Programming Tutorials Playlist:

C Practical LAB Exercises Playlist:-

=========================================

► Subscribe to our YouTube channel:

► Visit our Website:

=========================================
Hash Tags:-
#ChidresTechTutorials #JAVA #JAVATutorial
Рекомендации по теме