What will happen,if we compile below code

public interface intf_person
public int save_data(Person obj);
public DataSet load_data();

 Posted by vishalneeraj-24503 on 11/29/2013 | Category: OOPS Interview questions | Views: 2210 | Points: 40

It will not compile.As we can see,we have taken 1 interface intf_person, inside interface,we defined 2 method with public access modifiers.

If we compile,then it will give compile error as

"The modifier 'public' is not valid for this item"
Meaning that we can not write public access modifiers inside any interface.Because all the methods inside Interfaces are Public By-default.So we do not have to write Public keyword inside Interface.

Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Login to post response