villaawards.blogg.se

Bluej exercise solutions chapter 2
Bluej exercise solutions chapter 2










bluej exercise solutions chapter 2

This is the final result of the expression. After that, this decremented value of 3 is used in the expression. m first decrements the current value of m (which is 4) by 1 so m becomes 3. Current value of m becomes 4 after this step. Initial value of m is 5.Īt this step, current value of m (which is 5) is used in the expression and then value of m is decremented to 4. Reason - Putting the values of variables in the expression: Expression Int m,p m=5 p=0 p= m- + -m The output will be: Reason - Putting the values of variables in the expression:Ĭ = 55.0 Question 9 Reason - m*=8 is equivalent to m=m*8 ⇒ m = 8 * 8 = 64. What will be the result of m in the expression m*=8 if m=8 ? Here c = 25 % 5 which results in 0 as when 25 is divided by 5, we get the quotient as 5 and remainder as 0.

Bluej exercise solutions chapter 2 mod#

Reason - The expression uses mod operator (%) which returns the remainder after the operation. If int a=25, b=5, c=0 what value is stored in c when c = a%b? Hence, first the value of a is printed and then it is incremented. Reason - a++ uses an increment postfix operator which works on the principle- 'Action then change'. What will be the output of a++, if int a= -1 ? It can be used to write a Java expression into short form provided same variables are used after and before the assignment sign (=). Reason - Here, += is a Shorthand operator. A set of characters is assigned to a String variable. Reason - A string data type represents a set of characters enclosed within double quotes. Reason - A character literal represents a single character enclosed in single quotes (' ').

bluej exercise solutions chapter 2

Reason - A character literal represents a single character enclosed in single quotes (' ') and it is assigned to char type variable. Chapter 4 - Unit 1 Basics of Java Programming Class 8 - APC Understanding Computer Studies with BlueJ












Bluej exercise solutions chapter 2