Jurica Krizanic - Java developer, OCPJP6, Spring Core certified developer!
SCJP 5 | SCWCD 5
[How to ask questions] [Twitter]
Jurica Krizanic - Java developer, OCPJP6, Spring Core certified developer!
Maxwell Wood wrote:What is the output for the below code ?
options
A)1 2 red blue
B)Compile Error - because Scanner is not defind in java.
C)1 fish 2 fish red fish blue fish
D)1 fish 2 fish red blue fish
Correct answer is : A
i don't know what Delimiter does so maybe that's why i don't understand it
???
[Devaka: Edited to add code tags]
Faheem Khan wrote:
Maxwell Wood wrote:What is the output for the below code ?
options
A)1 2 red blue
B)Compile Error - because Scanner is not defind in java.
C)1 fish 2 fish red fish blue fish
D)1 fish 2 fish red blue fish
Correct answer is : A
i don't know what Delimiter does so maybe that's why i don't understand it
???
[Devaka: Edited to add code tags]
Hi all,
If you follow the logic and understand how delimiters work then the correct answer is indeed A.
But!
I was told if the source code begins from 'line 1' then you have to assume you're given the whole source code.
The source code we're given doesn't import java.util.Scanner nor does it explicitly refer to Scanner as java.util.Scanner in the code... instead it's using Scanner like it's already been imported.
As java.util.* isn't implicitly imported like java.lang.* surely it would be a compilation error?
Faheem Khan.
Jurica Krizanic - Java developer, OCPJP6, Spring Core certified developer!
Jurica Krizanic wrote:...Are the imports going to be always displayed in a code sample in the exam, or we should assume that imports are written even if we don't see imports in the code sample?...
SCJP 5 | SCWCD 5
[How to ask questions] [Twitter]
Faheem Khan wrote:....I was told if the source code begins from 'line 1' then you have to assume you're given the whole source code.
SCJP 5 | SCWCD 5
[How to ask questions] [Twitter]
Consider Paul's rocket mass heater. |