I\'ve following class
class MyClass implements Intrfc {
String pickmeUp = \"Its Me\";
public static void main(String[] args){
Intrfc ob = new MyClass();
ob.pi
No, you can't access the class variable using interface type, but the interface can define method that can access to the variable.
interface Intrfc {
public String getPickmeUp();
}
class MyClass implements Intrfc {
String pickmeUp = "Its Me";
public String getPickmeUp(){
return pickmeUp;
}
public static void main(String[] args){
Intrfc ob = new MyClass();
ob.getPickmeUp();
}
}