posted 7 years ago
Source :- Sahil Rally's Creation !!!
Quote at each line , Compilation Error or Runtime Error or Nothing???
Please be ready for
( Only for SCJP aspirants , even SCJP aspirants dont mind my statement , This is just to impart your more focus on the above question and to make you feel interested and enthusiastic )
Best Wishes !!!
Cheers!!!
Reference for rules:
http://www.coderanch.com/t/498524/java-programmer-SCJP/certification/ID-SCJP-day-Wednesday-June
Quote at each line , Compilation Error or Runtime Error or Nothing???
Please be ready for

Best Wishes !!!
Cheers!!!
Reference for rules:
http://www.coderanch.com/t/498524/java-programmer-SCJP/certification/ID-SCJP-day-Wednesday-June
SCJP 6.0 96%
(Connecting the Dots ....)
posted 7 years ago
Line 1, runtime error IndexOutOfBoundsException
Line 2, Compile error, Expecting String got anything
Line 3, Compile time error, something with the char literal being empty
Line 4, Compile error, Expecting char, char got char, anything
Line 5, prints out "sahil", the substring method can take length argument, it just returns same string
Line 6, I'm gonna go with IndexOutOfBoundsException
Line 7, false
Sahil, thanks for the effort you put in these questions
Regards,
Martin
Line 2, Compile error, Expecting String got anything
Line 3, Compile time error, something with the char literal being empty

Line 4, Compile error, Expecting char, char got char, anything
Line 5, prints out "sahil", the substring method can take length argument, it just returns same string
Line 6, I'm gonna go with IndexOutOfBoundsException
Line 7, false
Sahil, thanks for the effort you put in these questions
Regards,
Martin
SCJP 6, OCMJD 6, OCPJWSD 6
I no good English.
posted 7 years ago
line 1: string index out of bound
line 2: false
line 3: i am really confused with this one ... if the two '' have no space then there has to be a compilation error otherwise it replaces fine
line 4: String.replace() does not accept boolean values as replacement parameter
line 5: again string out of bound
line 6: wrong end parameter .. string out of bound
line 7: true because i think no constructor will be called here as the string is already in uppercase ... i might be wrong though
good one sahil ... i really appreciate your efforts buddy ... these questions are really helping me to prepare for my scjp
line 2: false
line 3: i am really confused with this one ... if the two '' have no space then there has to be a compilation error otherwise it replaces fine
line 4: String.replace() does not accept boolean values as replacement parameter
line 5: again string out of bound
line 6: wrong end parameter .. string out of bound
line 7: true because i think no constructor will be called here as the string is already in uppercase ... i might be wrong though

http://plainoldjavaobject.blogspot.in
posted 7 years ago
@sahil nice question buddy, to me every line seems to give error except that last one,which will surely be true ,but the two sirs have already given the answers but i will also try ,here it goes:
Line 1, StringIndexOutOfBoundsException
Line 2, Should be false
Line 3, Char literal being empty compile time error
Line 4, Compile error,but cant think of a reason
Line 5, this should not print anything as there is no substring at 5
Line 6, may be index out of bounds
Line 7, true ,both the objects refer to same sequence of characters hence interned ,therefore its should be true
Line 1, StringIndexOutOfBoundsException
Line 2, Should be false
Line 3, Char literal being empty compile time error
Line 4, Compile error,but cant think of a reason
Line 5, this should not print anything as there is no substring at 5
Line 6, may be index out of bounds
Line 7, true ,both the objects refer to same sequence of characters hence interned ,therefore its should be true
No Dream Too Big