• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

check return type of method

 
Ranch Hand
Posts: 90
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 129
Firefox Browser Tomcat Server Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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 ..
 
amrut sabade
Ranch Hand
Posts: 90
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi i have this method

so how can i determine that this method returns true in if condition?
 
Ranch Hand
Posts: 173
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.


 
Ranch Hand
Posts: 258
2
IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
so, you want to call a method inside if statement ?
 
amrut sabade
Ranch Hand
Posts: 90
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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?
 
Avishkar Nikale
Ranch Hand
Posts: 173
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 90
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
ya i want to call method inside the if() and check where it is true...
 
Ranch Hand
Posts: 276
Netbeans IDE Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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..
 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Just for clarity, you're not checking the return type of the method, you're checking the returned *value*. They mean quite different things.
 
Marshal
Posts: 79240
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Have a look at the code conventions; there is something very similar to what you want in ยง10.5.2.
 
moose poop looks like football shaped elk poop. About the size of this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic