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

Answer Posted / rajat

No you cannot.
1. Because an interface cannot contain fields.
2. For methods also, you cannot give an access modifier
(public / private). By default, the methods will be public

Is This Answer Correct ?    17 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Is enum a value type c#?

662


What's the difference between class and object?

565


Which property of the textbox cannot be changed at runtime?

553


What is string programming language?

509


Why do we use virtual methods in c#?

587






What does .length do in c#?

617


What is the difference between int.parse and int.tryparse methods?

649


What is readline library?

591


What is the difference between CreateObject() and GetObject()?

631


What is the use of thread join in c#?

585


What is string interpolation in c#?

623


i want o/p 011242110 in c# code.

1731


Explain the difference between “as” and “is” operators used in c#?

585


What is a copy constructor in c#?

588


What is private and shared assembly?

637