Notes for You:: Arithmetic Operators in Java - Java Tutorial 17
- Java provides 5 arithmetic operators to perform arithmetic operations. They are
Addition Operator(+):
- gives sum of two numbers.
Subtraction Operator (-):
- gives difference between two numbers.
Multiplication Operator (*):
- gives product of two numbers.
Division Operator (/):
- gives quotient of a complete division operation.
Modulus Operator (%):
- gives remainder of a first division operation.
Example Code:
package arithmeticoperatorsdemo;
public class ArithmeticOperatorsDemo
{
public static void main(String[] args)
{
System.out.println(2+2); // 4
System.out.println(5+2); // 7
System.out.println(5-2); // 3
System.out.println(10-2); // 8
System.out.println(5*2); // 10
System.out.println(10*2); // 20
System.out.println(10/2); // 5
System.out.println(10%2); // 0
System.out.println(11/(float)2); // 5.5
System.out.println(11%2); // 1
System.out.println(0/100); // 0
// System.out.println(100/0); // division by zero error
System.out.println('A' + 'A'); // 130
System.out.println('B' - 'A'); // 1
System.out.println( 2 + 2 ); // 4
System.out.println( "Hello " + "world" ); // Hello world
System.out.println( "Hello " + 2 ); // Hello 2
System.out.println( true + " world" ); // true world
}
}
=========================================
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
Arithmetic Operators in Java - Java Tutorial 17
Теги
arithmetic operators in javaarithmetic operators in java languagearithmetic operators in java programmingprecedence of arithmetic operators in javatypes of arithmetic operators in javaoperators in javatypes of operators in javajava tutorialjava tutorialsprogramming language tutorialcomputer programming languagechidres tech tutorials javachidres tech tutorialsmanjunath chidre