• Advertisement
Sign in to follow this  

Java, 'Use the interface keyword to declare instance variables?' oracle java apprentice test

This topic is 1906 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello Gamedev, I'm gonna start studying for the Oracle Certified Java Apprentice certification soon so I was taking a practice test to see what it was all about. Most of it was pretty straight forward and easy but there were a few questions that I just totally didn't get. I don't know if It's just not a high quality test, or, more likely, My self taught understanding of Java is a bit off in some ways. Here is one question that really confused me:

Q: Which of the following keywords is used to declare an instance variable?

A - abstract
B - Constant
C - Concrete
D - interface

I had no idea what the answer was so I guessed, I don't even remember what, but according to the test the answer was interface, which really confused me. I thought it was asking which Java keyword you use when your declaring an instance variable(I didn't know the declaration was what determined whether something was an instance variable or not at all, I thought it had to do with whether it belonged to an instance of a class).

can someone explain this to me? What do the mean 'using the interface keyword to declare an instance variable?'

And clearly something is wrong with my understanding of instance variables and maybe interfaces, based on the little paragraph above explaining my understanding of the topic can anyone correct me so I can comprehend the whole big picture a little better.

Thanks guys

Share this post


Link to post
Share on other sites
Advertisement
You are certain that you got the question right ? Only abstract and interface are valid keywords and none is used to declare a variable.

If you already didn't know, take a look here when studying for OCJA.

Share this post


Link to post
Share on other sites

You are certain that you got the question right ? Only abstract and interface are valid keywords and none is used to declare a variable.

If you already didn't know, take a look here when studying for OCJA.


I second that. That doesn't sound like a valid question. But I would say the fact that you had to ask the question means you do recognize something is weird.

Share this post


Link to post
Share on other sites
abstract-used to declare class
interface-used to declare interface
concrete and constant-not java kewords..

I think the question meant what type you can use to declare an instance variable?
So reinterpreting the question

abstract-can't use abstract class type to declare an instance.
interface-valid. An interface can refer to a class type

constant and concrete-not java keywords Edited by lride

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement