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


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies 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: 3169
    
  10
One will compile and one will not.


Joanne
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 13872
    
  10

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 7 API documentation
Scala Notes - My blog about Scala
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
 
Similar Threads
Doubt Reg: initializing Variables with method call
Implementation of remote/local mode communication
Issues With Enum
need packages help
regarding class definition