praveen kumaar wrote:. . . it will run ofcourse . . . .
Not the first piece of code, which has a statement outside methods and constructors. That code will not compile because statements must be in side methods constructors, etc. You cannot write a statement simply in the class.
The statements shown, e.g.
Math.pow(a, 3);, have no effect because their return values are not used; they simply disappear into cyber‑limbo never to be seen again. Also you should probably not use pow for small integer arguments; the following will probably be faster:-
a * a * a