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

This question is related to JAVA Given the following declaration int i1 = 1; Int

ID: 3603536 • Letter: T

Question

This question is related to JAVA

Given the following declaration int i1 = 1; Int i2 = 2 String S1 = "Hello", String S2 "HELLO". double d1 = 1.0 double d2 2; For each of the tollowing comparisons, specity * Which are syntactically correct? . Which are syntactically incorrect? * Which are syntactically correct but logically questionable? Only specify the answer on the following table; an example is given Syntactically Syntactically Syntacticallycorrect, but incorrect Comparisons logically uestionable correct sl--"Hello" s1 ==d1 i2_d2 null i1 equals (i2) d1.equals(d2) (s1-s2).equals(null) i1-12 == 0 s1.equals (s2)

Explanation / Answer

Answer:

Comparisons

i1 == i2 --- Syntactically Correct
d1 == d2 Syntactically Correct
s1 == "Hello" Syntactically Correct, but logically questionable
s1 == s2 Syntactically Correct, but logically questionable

s1 == s1 Syntactically Correct, but logically questionable

i2-d2 == null Syntactically Incorrect

i1.equals(i2) Syntactically Correct

d1.equals(d2) Syntactically Correct

(s1-s2).equals(null) Syntactically Incorrect

i1-i2==0 Syntactically Correct

s1.equals(s2) Syntactically Correct

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