Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Evaluate the expressions and identify their types (not for booleans) using the f

ID: 3840045 • Letter: E

Question

Evaluate the expressions and identify their types (not for booleans) using the following declarations int c = 4; int d = 17; boolean isAvailable = true; double delta = 8.5; char ch = '8'; string label = "vacation"; The keyword to make a variable a constant (unable to change its value) _____ Term when two methods in one class have the same name, but different parameter lists _____ Word to describe when more than one reference variable is bound to an object _____ Keyword used to make a member of a class hidden _____ The goal is to store the integer part of d into x. What needs to be added to line 2 that it will work? a. public static void method1 (double d) {int x = d;//line 2 A method whose job is to initialize the state of an object_____

Explanation / Answer

(1)3+d/c-2 =3+4-2=5 because d/c as int /int will result as int value of 4 .type of the answer is int .

(2)d/2*delta= 8*8.5= 64, type of the amswer is double

(3)(delta+0.5)/2= 9.0/2=4.5 , beacuse 9.0 is type of double and double / int will result as type of double .So result is type of double

(4)label.charAt(4) will get the character at index 4 or fifth character so type of the result is char

(5)ch!= 8 is true because ch='8' is a character but ch as 8 is integer .so value is true.

(6)delta>=8.0||inAvailbale results as true||true and that will result as true .so value is true.

(7)label.charAt(1) is the character at index 1 or it's second character of the string that is 'a' and it's less than 'z' so the result will be true for this.

(1) in c and c++ we use const keyword and in java static final variable reacts like a constant

(2)method overloading

(3)multibound

(4)abstract

(5)int x= (int) d;

(6)Constructor

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote