Link to home
Start Free TrialLog in
Avatar of royalcyber
royalcyber

asked on

static method

Hi ,

if i have a method static:

public static String authenticate ( String var1, String var2)


1)do i need to instantiate it with "new" command

2) whats the benefit of making the method static

30 what are the disadvantages of making the method static

thanks
RC
Avatar of Harisha M G
Harisha M G
Flag of India image

Hi royalcyber,
    1) If you want.
    2) You can call the method without creating the object of the class.
    3) If you don't want, skip it, there is no disadvantage.

Bye
---
Harish
royalcyber,
    For example if you have a class Base with a static method Index, then you don't have to create an object of the class Base for calling the function Index

For ex: if not static, Base b = new Base(); b.Index();
If static, Base::Index();
Avatar of iRadioDev
iRadioDev

ASKER CERTIFIED SOLUTION
Avatar of doronb
doronb

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks :)