Calling a Method in Java
By Ramakrishna on Sep 22, 2008 in Calling Java Objects
Calling a Method in Java : The methods called in java in 2 types
a) Create an object to the class to which the method belongs
syntax:
Classname obj=new Classname();
ForEx : First is a java program
then we can create and object to that class as follows:
First f=new First();
Here ‘f’ is the object of the class First
b) Then using object name.Method name(Call the method using obj.method() )
we should call the method:
Syntax:
“Obj.method();”
ForEx : Consider First is a java program
First f=new First();
Here ‘f’ is the object of the class First
f.method1();

1 Trackback(s)