LATEST

Wednesday, April 29, 2020

OPERATORS ONE LINER PART 02

OPERATORS ONE LINER PART 02

1) What are order of precedence and associativity?
Ans : Order of precedence the order in which operators are evaluated in expressions.
Associativity determines whether an expression is evaluated left-right or right-left.


2) Which Java operator is right associativity?
Ans : = operator.

3) What is the difference between prefix and postfix of -- and ++ operators?
Ans : The prefix form returns the increment or decrement operation and returns the value of the increment or decrement operation.
The postfix form returns the current value of all of the expression and then performs the increment or decrement operation on that value.

4) What is the result of expression 5.45 + "3,2"?
a)The double value 8.6    
b)The string ""8.6"
c)The long value 8.       
d)The String "5.453.2"
Ans : d

5) What are the values of x and y ?
x = 5; y = ++x;
Ans : x = 6; y = 6

6) What are the values of x and z?
x = 5; z = x++;
Ans : x = 6; z = 5

No comments:

Post a Comment