File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Compile error

 
Suja Mudunuri
Greenhorn
Posts: 14
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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);
}
 
Horatio Westock
Ranch Hand
Posts: 221
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 14
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 221
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have a look at The Java Tutorial.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic