Meaningless Drivel is fun!*
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


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: 3602
    
  15
One will compile and one will not.


Joanne
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14193
    
  20

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
 
GeeCON Prague 2014
 
subject: diff bet two methods