aspose file tools*
The moose likes Java in General and the fly likes check return type of method Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "check return type of method" Watch "check return type of method" New topic
Author

check return type of method

amrut sabade
Ranch Hand

Joined: Aug 16, 2010
Posts: 90
hiiiii i am new to java i have one boolean function where i have to check return type of method in if condition how can i do that please help me
vijin das
Ranch Hand

Joined: Jun 07, 2010
Posts: 129

amrut sabade wrote:hiiiii i am new to java i have one boolean function where i have to check return type of method in if condition how can i do that please help me


please make it clear so that some one can help you try giving that code snippet and ask where you want exact help ..


VIJINDAS
amrut sabade
Ranch Hand

Joined: Aug 16, 2010
Posts: 90
hi i have this method

so how can i determine that this method returns true in if condition?
Avishkar Nikale
Ranch Hand

Joined: Aug 06, 2010
Posts: 173
Can you elaborate what you are trying to accomplish?

There could be a lot of catches in what you are asking & we can lead you to the solution(not provide it).

Please use the code tag if you are trying to paste the code.



Regards,
Avishkar Nikale
Raymond Tong
Ranch Hand

Joined: Aug 15, 2010
Posts: 230
    
    2

so, you want to call a method inside if statement ?
amrut sabade
Ranch Hand

Joined: Aug 16, 2010
Posts: 90
sure iam trying to access a field of form using bean n chech where name is less than 3 characters if it is less than that return false...... check this condition in a actionclass n accordingly redirect the page.. so i just need how the return type of the method can be checked so as to redirect page
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

amrut sabade wrote:hi i have this method

so how can i determine that this method returns true in if condition?


Well, the easiest way is to call the method and see what it returns. Any reason you can't do that?


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
Avishkar Nikale
Ranch Hand

Joined: Aug 06, 2010
Posts: 173
I suggest you start by reading a good book on Java to get hold on
language constructs.

This is very trivial & once you go through a good book you can write this code.

For your information the if condition accepts any boolean value or
call to a boolean function inside the round-brackets.

Hope this will lead you to the solution.
amrut sabade
Ranch Hand

Joined: Aug 16, 2010
Posts: 90
ya i want to call method inside the if() and check where it is true...
Vinoth Kumar Kannan
Ranch Hand

Joined: Aug 19, 2009
Posts: 276

amrut sabade wrote:so how can i determine that this method returns true in if condition?

Just call that method by passing some argument, you'll get to know what this method returns.

Is this what you want? I'm not sure of my interpretation though..


OCPJP 6
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Just for clarity, you're not checking the return type of the method, you're checking the returned *value*. They mean quite different things.
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 39395
    
  28
Have a look at the code conventions; there is something very similar to what you want in ยง10.5.2.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: check return type of method