Error for public static double pow -
i new @ java forgive me if ask stupid question. have assignment need calculate pow of 2 numbers (lets it's 2.0^3) supposed use public static double pow() . reason following errors:
for ecpipse it's- error: not find or load main class exp.e
and drjava- static error: no method in static pow has name 'main'
class pow
{
public static double pow( double x, long y ) { x = 2.0; y = 3; double exp = math.pow(x,y); return exp; }
}
i must missing basic. spent significant amount of time on , can't figure out. please point me out doing wrong
you missing main
method.
every program in java starts calling public static void main(string[])
method. code doesn't seem have method. need create one, program run. other methods should called main
, or method called main
, or method called method called main
. so-called call stack, because methods "stacked" when called , removed stack when on (hopefully return
statement, such in method). when stack uses memory, have "stack overflow" error - which, not coincidence, name of website.
hope helps.
Comments
Post a Comment