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

What are the uses of delegates in c#?

780


What is the file extension for c#?

694


Can extension methods access private members?

669


What is a clr (common language runtime)?

668


Can a static class contain non static members?

739


Can you prevent a class from being instantiated?

765


What do you understand by an Implicit Variable?

719


Explain how can you clean up objects holding resources from within the code?

676


what is the difference between convert.tostring() and tostring() functions ?

791


What is CLR and its application.?

746


What is polymorphism in c sharp?

716


What is predicate c#?

715


What are access modifiers used for?

795


How to get the sum of last 3 items in a list using lambda expressions?

692


What does readonly mean in c#?

739