Found these questions over at JavaOnline. I'm simply looking to confirm my answers for this exercise.
C A S T I N G Question No : 1) In the following class definition, which is the first line (if any) that causes a compilation error. Select the one correct answer. char c; int i; c = 'A';// 1 i = c;//2 c = i + 1;//3 c++;//4 A. The line labeled 1. B. The line labeled 2. C. The line labeled 3. D. The line labeled 4. E. All the lines are correct and the program compiles Question 2) Which line in the following code will not compile 1. byte b=5; 2. char c='5'; 3. short s=55; 4. int i=555; 5. float f=555.5f; 6. b=s; 7. i=c; 8. f=i; Question 3) Will the following code compile ? 1. byte b=2; 2. byte b1=3; 3. b*=b1; Question No.4)In the code below what are the possivle types for variable result ? 1. byte b=11; 2. short s=13; 3. result=b*s; 1) byte, short, int, long, float, double. 2) boolean, byte, short, char, int, long, float, double. 3) byte, short, char, int, long, float, double. 4) byte, short, char. 5) int, long, float, double. _____________________________________________ Answers: 1) c 2) 6 3) Yes 4) 5
Hello Jimmy, Your answers are correct. Gurpreet Sachdeva For mock exams and other useful pages(including topics like bitshift operator, garbage collection,inner classes,etc) please visit: http://www.go4java.20m.com
Regards<BR>Gurpreet Sachdeva<P>For Mock Exams, FAQ, Exam tips and some useful information about Bitshift operator, inner classes, garbage collection,etc please visit: <A HREF="http://www.go4java.lookscool.com" TARGET=_blank rel="nofollow">http://www.go4java.lookscool.com</A>