File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes What if i want a return Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Reply locked New topic

What if i want a return

Duc Nguy

Joined: Nov 12, 2001
Posts: 7
What should i put if i want a return?
James Hobson
Ranch Hand

Joined: Aug 28, 2001
Posts: 140
or if you want to return an int, you could do
public int myMethod() {
return 5;
I think you need to be more specific in your question.
Eric Johnson
Ranch Hand

Joined: Apr 30, 2001
Posts: 49
put the data type as the return type. if your code will return an int, put int. if it returns a string, put String. if it returns an object, put the object. for instance,

will return the int 3 to whatever calls it.
William Barnes
Ranch Hand

Joined: Mar 16, 2001
Posts: 986

I feel like I am writing this program with Duc

Please ignore post, I have no idea what I am talking about.
Don't get me started about those stupid light bulbs.
subject: What if i want a return
It's not a secret anymore!