Creat a program to demonstrate the use of Unary operators. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Creat a program to demonstrate the use of Unary operators.

class UnaryArithmetic { public static void main(String args []) { int a=20 , result; result = +a; System.out.println(result); result = -a; System.out.println(result); result = ++a; System.out.println(result); result = --a; System.out.println(result); result = a++; System.out.println(result); result = a--; System.out.println(result); } }

21st Sep 2018, 11:08 AM
Manya
Manya - avatar
1 Answer
0
!
21st Sep 2018, 11:18 AM
Matthias
Matthias - avatar