15
Reply

Whats is the use of a private constructor? Calling non- static method from a static class, Is this possible?

Deepha Balachandran

Deepha Balachandran

Sep 08, 2016
2k
1

    1.We can prevent object creation from outsider class when we have only Private Constructor(s). 2. Create an instance of non static's method's class and invoke nonstatic method

    Manju Kaniappan
    September 06, 2017
    0

    1.We can prevent object creation from outsider class when we have only Private Constructor(s). 2. Create an instance of non static's method's class and invoke nonstatic method

    Manju Kaniappan
    September 06, 2017
    0

    Yes

    Mukesh Kumar
    September 04, 2017
    0

    Yes

    Mukesh Kumar
    September 04, 2017
    0

    Yes

    Mukesh Kumar
    September 04, 2017
    0

    Yes

    Mukesh Kumar
    September 04, 2017
    0

    Yes

    Mukesh Kumar
    September 04, 2017
    0

    Yes

    Mukesh Kumar
    September 04, 2017
    0

    Yes

    Mukesh Kumar
    September 04, 2017
    0

    Yes

    Mukesh Kumar
    September 04, 2017
    0

    Yes

    Mukesh Kumar
    September 04, 2017
    0

    Yes

    Mukesh Kumar
    September 04, 2017
    0

    you can call non-static method from static method. See example public class MyClass {private void data1(){}private static void data2(){MyClass c = new MyClass();c.data1();} }

    sushil kumar
    July 20, 2017
    0

    http://www.c-sharpcorner.com/uploadfile/0c1bb2/constructors-and-its-types-in-c-sharp/

    Vinay K
    March 17, 2017
    0

    Not Possible.Class cannot have private constructor and static class cannot have non static method.

    Ayappan Alagesan
    February 10, 2017
    0