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 Compile error Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Compile error" Watch "Compile error" New topic
Author

Compile error

Suja Mudunuri
Greenhorn

Joined: Jul 28, 2004
Posts: 14
This is my method and in this method I am doing different mathematical operations. I am calling this method by passing an int.
Compiler gives me the following errors. I don't understand why. Can somebody help me?

int x = 2;
Vnumbers(x);

public void Vnumbers(int a){
int b = a;
System.out.println("Value of b is : " + b);
}


C:\Sujatha\MyProjects\java\Hellow.java:39: invalid method declaration; return type required
Vnumbers(x);
^
C:\Sujatha\MyProjects\java\Hellow.java:39: <identifier> expected
Vnumbers(x);
^
C:\Sujatha\MyProjects\java\Hellow.java:39: ')' expected
Vnumbers(x);
^
3 errors


int x = 2;
Vnumbers(x);

public void Vnumbers(int a){
int b = a;
System.out.println("Value of b is : " + b);
}


Sujatha Mudunuri<br />SCJP 1.4<br />(Preparing SCWCD 1.4)
Horatio Westock
Ranch Hand

Joined: Feb 23, 2005
Posts: 221
Hi,

It looks like you are calling the method in the top level of the class, rather than in the body of another method?



Could you post your entire class source please?
Suja Mudunuri
Greenhorn

Joined: Jul 28, 2004
Posts: 14
Yes, that is what I have done. I corrected it and it is working fine.
Thank You.
I am looking for some samples to review all my basics. If you have any samples can you please give me?

Regards,
Horatio Westock
Ranch Hand

Joined: Feb 23, 2005
Posts: 221
Have a look at The Java Tutorial.
 
wood burning stoves
 
subject: Compile error
 
Similar Threads
ClassPath problem
how the program works?
Exception Handling
Cannot able to get the Output
If condition