Login


Lost your password?

Don't have an account ?
Register (It's FREE) ×
  


Shop
Java All : Operators (Arithmetic-Assignment-Unary-Relational-Logical)
Concept Learning Code Sheets
Sum of Inputs #557 

This is a program to learn different ways of getting the desired console output

Arithmetic Operators #3657 

Addition, subtraction, multiplication, division and modulus operator

Simple Assignment and Compound Assignments #3661 

Using simple assignment means = operator and special variations with arithmetic operators like +=, -=, *=, /= and %= .

Unary Operator Post and Pre Operations #3663 

Understanding unary increment with post operation and pre operation example.

Relational operators usage for data comparison #3676 

Use of equality check operator == and other relational operators like not equal to !=, less than < , greater than > , less than or equal to <= and greater than or equal to >=  operators.

Unary Operator plus, minus and inversion #3692 

Understanding unary operator plus, minus and inversion.

Conditional or Logical Operators AND, OR #3698 

Understanding the use of condition operators and (&&) and or (||)

Conditional Ternary Operators #3702 

Understanding the use of conditional ternary operator with three operands

Operator precedence in arithmetic and unary expressions #3735 

Understanding operator precedence with simple arithmetic and unary operators.

Operator precedence with brackets #3738 

Understanding operator precedence when brackets are used.

Operator precedence with comparison and logical operators #3740 

Understanding operator precedence with comparison(relational) and logical(conditional) operators.

Auto conversion, Widening Type Promotion or Implicit Casting #3787 

Understanding rules of widening type promotions from byte->short->int->long->float->double.

Solved Problems
Increment, Decrement operator Output Writing #3666 

Write output of the following program instructions.

int a=10;
System.out.println(a++);
int b = –a;
System.out.println(b);
b= b++ – -a;
System.out.println(b++);
a= –b + ++a;
System.out.println(a);

Write output of the following program instructions. int a=10; System.out.println(a++); ...
Arithmetic operator with different data types Output Writing #3669 

Write output of the following program instructions.

int a=5;
float b=9.0f;
double c= a+b;
double d=b+a/2;
System.out.println(c);
System.out.println(d);

Write output of the following program instructions. int a=5; float b=9.0f; double c= ...
Assignment operators based Output Writing #3672 

Write output of the following program instructions.

int a=10;
int b=a=12;
System.out.println(a+b);
b%=5;
a/=b;
System.out.println(a+b);

Write output of the following program instructions. int a=10; int b=a=12; System.out. ...
Relational operators based Output Writing #3682 

Write output of the following program.

class SP_RelationalOP
{
  public static void main(String[] args)
  {
    float x=2.35f; 
    int y=2;
    System.out.println(x!=y);
    System.out.println(x<y); 
    System.out.println(y>x);
    System.out.println(y>=x);
    System.out.println(y<=x);
    System.out.println(x==2.35);
    System.out.println(x==2.35f);
  }
}

 

Write output of the following program.
class SP_RelationalOP
{
  public static voi ...		
Conditional Operator Output Value Proving #3704 

Prove that output of the following program would be true.

 

class SP_ConditionalOP
{
  public static void main(String[] args)
  {
    double d1=7.95,d2=15.90;
    boolean x=(2*d1==15.90 && d2/2==7.95);
    boolean y=(2*d1==15.90 || d2/2==7.95);
    boolean z=(x || y);
    System.out.println(z);
  }
}

 

Prove that output of the following program would be true.  
class SP_Conditi ...		
Precedence of Operator #3911 

Operators with higher precedence are evaluated before operators with relatively lower precedence. Arrange the operators given below in order of higher precedence to lower precedence.

(i) &&
(ii) %
(iii) >=
(iv) ++

Operators with higher precedence are evaluated before operators with relatively lower prec ...
Exam Questions
ICSE2014-02A  Precedence of Operator #3911 

Operators with higher precedence are evaluated before operators with relatively lower precedence. Arrange the operators given below in order of higher precedence to lower precedence.

(i) &&
(ii) %
(iii) >=
(iv) ++

Operators with higher precedence are evaluated before operators with relatively lower prec ...
ICSE2018-03I  if-else to ternary conversion #4069 

Rewrite the following using ternary operator:
if (bill>10000)
discount=bill*10.0/100;
else
discount = bill*5.0/100;

Rewrite the following using ternary operator: if (bill>10000) discount=bill*10.0/100; ...
ICSE2017-01B  operator identification #4100 

Name the operators listed below
(i) <     ( ii) ++      (iii) &&     (iv) ?:

Name the operators listed below (i) <     ( ii) ++      (iii) &&     (i ...
ICSE2016-03E  if-else to ternary operator #4244 

Rewrite the following using ternary operator :
if(x%2 == 0)
System.out.print(“EVEN”);
else
System.out.print(“ODD”);

Rewrite the following using ternary operator : if(x%2 == 0) System.out.print("EVEN"); e ...
Quizzes

Code Sheets:12  Solved Problems:7  Exam Questions:8  Quizzes:6
Back