Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

Confusing interview question

navale_vsSep 18 2019 — edited Oct 15 2019

So, I went in to a recruiter for a pre-interview, which included a couple of java coding questions.  I got the first one right, but found the second one to be rather nonsense--unless I'm just that behind on java syntax.

The question:

Given an object person with a field hair-style (yes, the hyphen is part of it), how do you get the value of hair-style?

I pointed out the syntax error then said that it would have to be either person.hair-style if scope allows or to use an accessor method if one is provided.  The recruiter read the correct answer as person[hair-style].  They did show me the text of the question in order to confirm its contents.

I have only worked in Java up to version 8.  Is the above some change that was introduced in a later version?  I have tried searching online for more information, but am clearly not using the correct search string.

This post has been answered by rpc1 on Sep 19 2019
Jump to Answer

Comments

Post Details

Added on Sep 18 2019
3 comments
158 views