Question: What is printed by the following program? Make sure to give each value exactly as it would be shown in the output, observing the whitespace,

What is printed by the following program? Make sure to give each value exactly as it would be shown in the
output, observing the whitespace, newline characters, etc. If you believe this code would not compile or would produce no output
when run, leave the answer area blank.
1p u bli c c l a s s Sch o ol {
2 S t ri n g name ;
3
4 p u bli c Sch o ol ( S t ri n g theName ){
5 t h i s . name = theName ;
6}
7
8 p u bli c s t a t i c v oid main ( S t ri n g [] a r g s ){
9 Sch o ol s 1= new Sch o ol (RPI=1824) ;
10 Sch o ol s 2= s 1 ;
11 S t ri n g ye a r ==1900 ;
12 Sch o ol s 3= new Sch o ol (CMU=1900) ;
13 Sch o ol s 4= new Sch o ol (CMU+=1900) ;
14
15 System . out . p r i n t l n ( s 1== s 2) ;
16 System . out . p r i n t l n ( s 1. e q u al s ( s 2)) ;
17
18 s 1. name =CMU+ ye a r ;
19
20 System . out . p r i n t l n ( s 2== s 1) ;
21 System . out . p r i n t l n ( s 2. e q u al s ( s 1)) ;
22 System . out . p r i n t l n ( s 2== s 3) ;
23 System . out . p r i n t l n ( s 1== s 3) ;
24 System . out . p r i n t l n ( s 1. name == s 3. name ) ;
25 System . out . p r i n t l n ( s 1. name . e q u al s ( s 3. name )) ;
26 System . out . p r i n t l n ( s 3== s 4) ;
27 System . out . p r i n t l n ( s 2. e q u al s ( s 3)) ;
28 System . out . p r i n t l n ( s 3. e q u al s ( s 4)) ;
29 System . out . p r i n t l n ( s 4. e q u al s ( s 3)) ;
30}
31}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!