Java Challenge #2: Is It Going to Compile?

Is it going to compile? If not, why? If you think it’s going to compile, what will happen? What will be the output?

Try to solve this challenge before seeing the answer below.

is_it_going_to_compile.jpg

Answer: It is going to compile! You see, the variable can be created with a class name, no problem. We can use the semicolon “;” several times too.

The char array declaration can be done as shown above. Later, maybe in a vector challenge, I can explain what happens when brackets “[]” are put before the variable.

doesthisCompile: Yes again. This command, called label, can be used for controlling external loopings with “continue” or “break” command, for example.

We can use System.out.println on the looping and we don’t have to use a condition in the second part of the “for”.

Java Challenge #2: Is It Going to Compile?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s