Operators in Java

Posted on

Operators:

  • Arithmetic Operators: +, -, *, /, %, ++, –, +=, -=, *=, /=.
  • Relational Operators: >, <, >=, <=, ==, !=.
  • Logical Operators: &&, ||, !.
  • String Concatenation: +.

 

/*demo on operators*/

class App4{

public static void main(String yck[])
{

int x,y,sum;
x=10;
y=20;
sum=x+y;
System.out.println(“The value of x is : “+x);
System.out.println(“The value of y is : “+y);
System.out.println(“The sum of x & Y is : “+sum);
}
}

 

output:
\>javac App4.java
\>java App4
The value of x is : 10
The value of y is : 20
The sum of x & Y is : 30

Leave a Reply

Your email address will not be published. Required fields are marked *