Question: For the following program that involve casting, predict the result of compiling and running the program. Potential answers include there is a syntax error because

  1. For the following program that involve casting, predict the result of compiling and running the program. Potential answers include there is a syntax error because . . . , there is a run-time error because . . . , and the output of the program would be . . . .
    1. public class test2 {

public static void main(String[] args) {

String s1, s2; Object o1; s2 = "E. E. Cummings"; o1 = s2; s1 = (String) o1; S y s t e m. o u t . p r i n t l n ( s 1 . t o L o we r C a s e ( ) ) ;

}

}

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!