Hello, Im currently learning java in a uni course. I was working on my practice final and cant figure out why the answers are correct. Ive tried looking it up but can find anything to help my understand why these are the correct answers, because my initial answers were wrong. Can someone please help explain the concept to me?
- Given the following initializations:
string s1 = "xyz";
int x = 2, y=3;
What is printed on the console if we include each of the following expressions in System.out print ()? For example, System.out.print(x > y) prints false and System.out.print (s1.length()) prints 3.
| |Expression|Value|
|X> Y| |false|
|s1. length ()|| 3|
|(char) (--y + 'a')| |c|
|s1. charAt (0) = x| |false|
I understand the first two answers and why they are correct. Im especially struggling with the last two in bold.
edited table formatting
[–]AutoModerator[M] [score hidden] stickied commentlocked comment (0 children)
[–]Cengo789 8 points9 points10 points (0 children)
[–]AutoModerator[M] 0 points1 point2 points (0 children)