This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes diff bet two methods 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 "diff bet two methods" Watch "diff bet two methods" New topic
Author

diff bet two methods

Shishir malviya
Greenhorn

Joined: Jun 21, 2005
Posts: 25
What is the difference between these definitions

public abstract void getData();
&
public abstract void getData(void);
Joanne Neal
Rancher

Joined: Aug 05, 2005
Posts: 3720
    
  16
One will compile and one will not.


Joanne
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14278
    
  21

The only difference is that the first line compiles, and the second line does not. I tried it for you and it gave a compiler error:

Jesper.java:4: illegal start of type
public abstract void getData(void);
^

(note: the "^" points to "void", but the forum software eats up the spaces...).
[ September 05, 2005: Message edited by: Jesper de Jong ]

Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 8 API documentation
Layne Lund
Ranch Hand

Joined: Dec 06, 2001
Posts: 3061
Originally posted by Jesper de Jong:
The only difference is that the first line compiles, and the second line does not. I tried it for you and it gave a compiler error:

Jesper.java:4: illegal start of type
public abstract void getData(void);
^

(note: the "^" points to "void", but the forum software eats up the spaces...).

[ September 05, 2005: Message edited by: Jesper de Jong ]


If you use UBB tags, you can force the software to preserve your spacing. In particular, either CODE or QUOTE tags will work.

Layne


Java API Documentation
The Java Tutorial
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: diff bet two methods