File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes method and function Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "method and function" Watch "method and function" New topic
Author

method and function

Harjeet Dadwal
Greenhorn

Joined: Sep 09, 2001
Posts: 17
What is the difference between method and function, why don't we call function in java instead of method whereas in c or c++ called function, is there any difference between function and method.
------------------
Harjeet Singh Dadwal


Harjeet Dadhwal
Bosun Bello
Ranch Hand

Joined: Nov 06, 2000
Posts: 1510
No, there is no difference. It's just that in java, they are called methods.

Bosun


Bosun (SCJP, SCWCD)
So much trouble in the world -- Bob Marley
Harjeet Dadwal
Greenhorn

Joined: Sep 09, 2001
Posts: 17
But I read in a book that there is a difference in that but no difference was described there.
* here we define function called method in a class itself that is why it is called method,
I think I read like this but I'm not able to remind which book I read in.
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
Hi!
Java support methods , classes , interface.
methods must be declared in a class. if you want to access the method directly without accessing it through an instance of a class you delcare the method static.
Java supports of course constructors. No struct , no function because methods and function are the same in java. a method can be declared. final , static , private , protected , public abtract , default( no access specifier ) , native. ( Hope I didn't leave anything out. ). You can only have at most one access modifier, that is: public , protected , private.
There is no destructors in java. You can override finialize() and call super.
// Mathias
William Barnes
Ranch Hand

Joined: Mar 16, 2001
Posts: 986


But I read in a book that there is a difference in that but no difference was described there. * here we define function called method in a class itself that is why it is called method, I think I read like this but I'm not able to remind which book I read in.

So there was a book you were reading that said Methods and Functions were not the same, but the book didn't explain the difference and you can't remember which book actually said this. Is that correct?
If so don't spend lots of time looking for the book and just take our word for it - they are the same thing.


Please ignore post, I have no idea what I am talking about.
Umair Uddin
Greenhorn

Joined: Sep 12, 2001
Posts: 14
there is no difference b/w functions,methods and procedures in jave these all things are point out to the smae thing .. dont be confused about access modifiers.. ...
Umair Uddin Qa dd'rouy
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: method and function