This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Simple question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Simple question" Watch "Simple question" New topic
Author

Simple question

suresh kamsa
Ranch Hand

Joined: Jul 30, 2001
Posts: 149

How do I make this code compile? I am getting Illegal start of expression at statement
public void int add(int N)
Thanks in advance.
[ June 07, 2002: Message edited by: Dirk Schreckmann ]
Corey McGlone
Ranch Hand

Joined: Dec 20, 2001
Posts: 3271
Originally posted by suresh kamsa:

Most Java methods only have 1 return type, not 2.


SCJP Tipline, etc.
suresh kamsa
Ranch Hand

Joined: Jul 30, 2001
Posts: 149
How do I make that programe compile error free?
I change it to
public int adder(int N)
still same error
Corey McGlone
Ranch Hand

Joined: Dec 20, 2001
Posts: 3271
You also probably want to take the method decalaration out of the main method. You can't have a method within a method. Here, this will compile:

I'm moving this to JiG (Beginner)
Corey
[ June 07, 2002: Message edited by: Corey McGlone ]
awais syed
Greenhorn

Joined: Mar 17, 2002
Posts: 7
because you can not declare method in any method.
but you call this like
[ June 08, 2002: Message edited by: Dirk Schreckmann ]

awais
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Simple question
 
Similar Threads
array and vararg overloading confusion
Hate to drag up old woes but..
Adding Values in arrays.
Overriding Vs. overloading
null pointer exception