+ 1

Java Output

Hi! 😊 im A learner wants to learn and take notes on challenge questions if its okay to you guys can you guys explain to me what happens to this code?need a clearer insight.tnx in advance😀 https://code.sololearn.com/ccXg3IDlpdB0/?ref=app

10th May 2018, 5:12 AM
Challenge Quest
Challenge Quest - avatar
6 Respuestas
+ 3
if you still need a whole explanation this is what i can provide: so here at line 6 we declared two boolean variables b and b1 in which we declared their default values which is b=false and b1=true at line 7 we declared char ch =65 at line 9 s1.toLowerCase().equals(s2) toLowerCase() is a method that returns strings into lowercase and equals() returns the comparison of two strings if they are the same.which is true so what b will actually return is b which is inside the if statetement which is b=!b its like this b=!false which is true and second if statement which is s1.charAt(6) specifies the char that the value represents which is 6 so when we count from 0-6 At "Sololearn" the char is 'a' which represents 97 in ASCII table so b1 is false so it will return the default value at line 6 which is true so b=true b1=true here is a link for ASCII Table👍 https://www.cs.cmu.edu/~pattis/15-1XX/common/handouts/ascii.html
10th May 2018, 7:29 AM
)_)
)_) - avatar
+ 2
s1 in lower case equals s2, so b=!b = !false = true
10th May 2018, 5:55 AM
Aaron Eberhardt
Aaron Eberhardt - avatar
+ 2
b1 would be false if the string would be "sololeArn" because 65 is the upper case a. Instead you might use 97 which is the lower case a
10th May 2018, 6:09 AM
Aaron Eberhardt
Aaron Eberhardt - avatar
+ 1
Tnx!Haha its noted📃 Disorder🚸🔭🌎
10th May 2018, 7:53 AM
Challenge Quest
Challenge Quest - avatar
0
tnx but, i actually knew that part what actually confused me is line 11 and 12 though still a "Whole" explanation from anyone for this code would be appreciated.
10th May 2018, 6:03 AM
Challenge Quest
Challenge Quest - avatar
0
tnx Aaron Eberhardt ,but there's still a doubt 😶cant marked it as solved theres something that i've been missing here id try to find by myself though.😉
10th May 2018, 6:31 AM
Challenge Quest
Challenge Quest - avatar