About Question enthuware.ocajp.i.v7.2.1166 :

Help and support on OCA OCP Java Programmer Certification Questions
1Z0-808, 1Z0-809, 1Z0-815, 1Z0-816, 1Z0-817

Moderator: admin

Post Reply
javaman
Posts: 33
Joined: Wed Nov 13, 2013 4:11 pm
Contact:

About Question enthuware.ocajp.i.v7.2.1166 :

Post by javaman »

Which line of code will not be acceptable to the compiler?

public class XBox{
volatile int root = 20; //1
private XBox() //2
{
volatile int i = 30; //3
}
private void XBox() //4
{
int local = 30;
}
}

What does the explanation "Only member variable can be volatile or transient." with the correct answer (3)?

javaman
Posts: 33
Joined: Wed Nov 13, 2013 4:11 pm
Contact:

Re: About Question enthuware.ocajp.i.v7.2.1166 :

Post by javaman »

that line should be
"What does the explanation "Only member variable can be volatile or transient." with the correct answer (3) mean?"

admin
Site Admin
Posts: 10068
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

Re: About Question enthuware.ocajp.i.v7.2.1166 :

Post by admin »

It means you can apply volatile or transient only to a member variable i.e. instance or static. Not to a local variable.

HTH,
Paul.
If you like our products and services, please help us by posting your review here.

Post Reply

Who is online

Users browsing this forum: No registered users and 123 guests