Unary Operators in Java | Postfix ,Prefix and Invert operators | Operators in Java

Published: 24 March 2024
on channel: Muhammad Shahzaib
9
4

ASSALAM o alaikum
Code:
public class OperatorsExample{

///////////////////// unary operators
public void PostfixIncrement(int a){
a++;
System.out.println(a);
}

public void PostfixDeccrement(int a){
a--;
System.out.println(a);
}

public void PrefixIncrement(int a){
++a;
System.out.println(a);
}

public void PrefixDeccrement(int a){
--a;
System.out.println(a);
}

public void PostFixConcept(int a){
int b=a++;
System.out.println(b);
}

public void PreFixConcept(int a){
int b=++a;
System.out.println(b);
}

public void Invert(boolean a){
boolean b=!a;
System.out.println(b);
}

}

/////// main class ////////////////////
public class App {
public static void main(String[] args) throws Exception {

OperatorsExample operatorsExample= new OperatorsExample();

operatorsExample.PostfixIncrement(5);

operatorsExample.PostfixDeccrement(5);

operatorsExample.PrefixIncrement(5);

operatorsExample.PostFixConcept(5);

operatorsExample.PreFixConcept(5);

boolean a=false;

operatorsExample.Invert(a);

}
}

For any suggestion/complaint :
mshahzaib6699@gmail.com


On this page of the site you can watch the video online Unary Operators in Java | Postfix ,Prefix and Invert operators | Operators in Java with a duration of hours minute second in good quality, which was uploaded by the user Muhammad Shahzaib 24 March 2024, share the link with friends and acquaintances, this video has already been watched 9 times on youtube and it was liked by 4 viewers. Enjoy your viewing!