Java for the ladies

My wife doesn’t really like coding, she can find her way around HTML, CSS en some Javascript… but only if I really don’t feel like doing it for her. Can’t blame her, she is a designer.

She does however like making puzzles, specifically numerical puzzles like sudoku.

While preparing for the upcoming exam I stumbled over the following question, which I asked her to try and figure out.

Place the fragments into the code to produce the output 33. Note, you MUST use each fragment exactly once

[java]
class Incr{
public static void main(String … args){
Integer x = 7;
int y = 2;

x __ __ ;
__ __ __;
__ __ __;
__ __ __;
System.out.println(x);
}
}
[/java]

The allowed fragments:

y y y y
y x x  
-= *= *= *=

After introducing her to some basic concepts ( x *= x could be written x = x*x) she got to work, and managed to come up with the answer. Can you?

This entry was posted in java. Bookmark the permalink.

78 Responses to Java for the ladies

  1. Danielle says:

    Yeah right, and the answer is? Did you mail that to Peter? ;)

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>