Homework help asap please: The equals method from the String class returns true if two strings contain the same characters, even if they refer to two different strings. true or false?
``` public class HelloWorld{ public static void main(String []args){ String a = "abc"; String b = "cde"; String c = "abc"; System.out.println(a==b); System.out.println(a==c); System.out.println(a.equals(c)); } } ``` the output of this program is: false true true
but what about the question? is the answer true or false? :)
System.out.println(a.equals(c)); evaluated to true a and c are different strings you tell me
so the answer is true I think. Also, Iwanted some help with another 2 questions : 1. a subordinate statement inside a while loop must always be inside braces. (True or false? just the overall answer) 2. see the coding: public void toggleCDs() { while (seesSlot()){ if (seesCD()) takeCD(); else putCD(); moveOn(); } } //======================= what would be the correct output if args = "101010" ? Assume the arm is at the beginning of the sequence.
no idea about the f irst one, post the full code on the 2nd
Here is the full code: public class whatever { public void toggleCDs() { while (seesSlot()){ if (seesCD()) takeCD(); else putCD(); moveOn(); } } //======================= in the application, it is public static void main (String[ ] args) { Vic sue; sue = new Vic(); sue.toggleCDs();
can you hand draw the out put for me please?
I have no idea what seesCDs() does, this isn't the full code
it means that if the vic sees the slot, and if it sees the CD it takes it . I found the online pdf of the book : http://www.cs.ccsu.edu/~jones/chap03.pdf site http://www.cs.ccsu.edu/~jones/book.htm
@woodrow73
righy
Thanks :)
Join our real-time social learning platform and learn together with your friends!