methods Archive

Constructors in Java

Constructors in Java Constructors are like normal methods or one can say, constructors are special type of methods with following properties Constructors shares the same name as the class name Constructors don’t have return type – not even void Constructors are invoked autometically on creation of object. Mostly used to initialize the object A class

Creating a method in Java

Creating a method in Java A method is a set of statements grouped together to perform an operation. Generally there are two types of methods. User defined methods : Usually a user creates to add additional functionality Predefinde methods :  Such methods are already written and provided by java such as Math.pow() General syntax for