Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Concepts of Database Management

Authors: Philip J. Pratt, Joseph J. Adamski

7th edition

978-1111825911, 1111825912, 978-1133684374, 1133684378, 978-111182591

More Books

Students also viewed these Databases questions