This week's book giveaway is in the Jython/Python forum.
We're giving away four copies of Hands On Software Engineering with Python and have Brian Allbey on-line!
See this thread for details.
Win a copy of Hands On Software Engineering with Python this week in the Jython/Python forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Bear Bibeault
  • Knute Snortum
  • Liutauras Vilda
Sheriffs:
  • Tim Cooke
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Ron McLeod
  • Ganesh Patekar
  • salvin francis
Bartenders:
  • Tim Holloway
  • Carey Brown
  • Stephan van Hulst

check return type of method  RSS feed

 
Ranch Hand
Posts: 90
  • Mark post as helpful
  • send pies
  • 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 Java Tomcat Server
  • Mark post as helpful
  • send pies
  • 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
  • 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
  • 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: 255
2
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • 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
  • 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
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • 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
  • 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
  • Quote
  • Report post to moderator
ya i want to call method inside the if() and check where it is true...
 
Ranch Hand
Posts: 276
Chrome Java Netbeans IDE
  • Mark post as helpful
  • send pies
  • 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
  • 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: 62188
193
  • Mark post as helpful
  • send pies
  • 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.
 
when your children are suffering from your punishment, tell your them it will help them write good poetry when they are older. Like this tiny ad:
RavenDB is an Open Source NoSQL Database that’s fully transactional (ACID) across your database
https://coderanch.com/t/704633/RavenDB-Open-Source-NoSQL-Database
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!