Next


Hello World Program
Unary Operators

class HelloWorld
{
 public static void main(String args[])
 {
  System.out.println("Welcome To Hello World");
 }
}

OUTPUT: Welcome To Hello World

							
							

UnaryMinus

class UnaryMinus
{
 public static void main(String args[])
 {
  int x=10;
  System.out.println("the sign value is"+(-x));
 }
}
OUTPUT: the sign value is -10

PreIncrement Operator(++x)

class PreIncrement
{
 public static void main(String args[])
 {
 int x=10;

  System.out.println("PreIncrement Is"+(++x));
 }
}
OUTPUT: PreIncrement Is 11

PostIncrement Operator(x++)

class PostIncrement
{
 public static void main(String args[])
 {
 int x=10;

  System.out.println("PostIncrement Is"+(x++));
 }
}
OUTPUT: PostIncrement Is 10

PreDecrement Operator(- -x)

class PreDecrement
{
 public static void main(String args[])
 {
 int x=10;

  System.out.println("PreDecrement Is"+(--x));
 }
}
OUTPUT: PreDecrement Is 9

PostDecrement Operator(x- -)

class PostDecrement
{
 public static void main(String args[])
 {
 int x=10;

  System.out.println("Predecrement Is"+(x--));
 }
}
OUTPUT: PostDecrement Is 10