About Question enthuware.ocajp.i.v7.2.995 :
Moderator: admin
-
- Posts: 32
- Joined: Wed Mar 14, 2012 5:45 pm
- Contact:
About Question enthuware.ocajp.i.v7.2.995 :
Hi there,
Explanation 4: Can you give me a sample code for an interface with a body?
Thanks.
Explanation 4: Can you give me a sample code for an interface with a body?
Thanks.
-
- Site Admin
- Posts: 10384
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.ocajp.i.v7.2.995 :
Code: Select all
interface I1{
int X = 10;
}
interface I2{
int X = 20;
}
interface I extends I1, I2{
int Y = X; //Error because of ambiguous reference to X
int Z = I1.X; //Valid
}
-
- Posts: 32
- Joined: Wed Mar 14, 2012 5:45 pm
- Contact:
Re: About Question enthuware.ocajp.i.v7.2.995 :
Thank youadmin wrote:Code: Select all
interface I1{ int X = 10; } interface I2{ int X = 20; } interface I extends I1, I2{ int Y = X; //Error because of ambiguous reference to X int Z = I1.X; //Valid }

-
- Posts: 2
- Joined: Thu Feb 28, 2013 2:02 am
- Contact:
Re: About Question enthuware.ocajp.i.v7.2.995 :
In Java 8 intarfaces may contain static methods and default methods. I thought that static methods were also available in earlier versions of Java
-
- Posts: 2
- Joined: Tue Apr 28, 2015 5:39 am
- Contact:
Re: About Question enthuware.ocajp.i.v7.2.995 :
4. Fields of an interface may be declared as transient or volatile but not synchronized.
Is it possible, to specify the "volatile" for the public statics final variable?
What's the point? Flows would not be able to change the final variable.
Is it possible, to specify the "volatile" for the public statics final variable?
What's the point? Flows would not be able to change the final variable.
-
- Site Admin
- Posts: 10384
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.ocajp.i.v7.2.995 :
That's right. Volatile doesn't make sense for final variables because such variables do not change.
-
- Posts: 2
- Joined: Tue Apr 28, 2015 5:39 am
- Contact:
Re: About Question enthuware.ocajp.i.v7.2.995 :
Thanks for your reply.
Who is online
Users browsing this forum: Bing [Bot] and 11 guests