interface variables declarations
package interfaces;
interface IVariable
{
int x=10;
public int px=15;
final int fx=20;
static int sx=40;
final static int fsx=50;
// All above declarations are same.
// By default interface variables are public static final
private int pi=60; //error
volatile int vx=80; // error
}
public class InterVariable implements IVariable{
public static void main(String arg[])
{
System.out.println(x); //10
x=30; //error
}
}
1 comments:
please, provide output of the codes with explanation....
Post a Comment