Can we define a variable with the access modifier private
in an interface?

Answer Posted / hp

Yes we can declare variables in interafces
sample:
public interface nexusConstants {
// servlet names
public final String CSR_QUERY_SERVLET = "/qryCSS";
public final String MY_BILL_QUERY_SERVLET = "/qryMyBill";
public final String MY_HOME_QUERY_SERVLET = "/qryMyHome";
public final String TRY_BILL_QUERY_SERVLET = "/qryTryBill";
public final String CSR_XFER_SERVLET = "xferCSS"; }

This can be used by any class which require th values.
I have a live application which uses the interface variables.

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How many variables do you need?

584


What is ilist c#?

596


Can a class be protected in c#?

565


What is selector c#?

584


What is console read in c#?

559






What is the best dependency injection c#?

545


What method is used to sort the elements of the array in descending order?

638


What is generic method in c#?

571


What are destructors in C#?

989


What is private readonly in c#?

618


How do I know if executenonquery is successful c#?

538


Does c# have primitives?

545


What is difference between dynamic and var in c#?

566


Explain the difference between “constant” and “read-only” variables used in c#?

615


What is dll in vb.net?

565