wood burning stoves 2.0*
The moose likes Beginning Java and the fly likes I would like to place a Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "I would like to place a "CallingMethod" inside of an " if " loop" Watch "I would like to place a "CallingMethod" inside of an " if " loop" New topic
Author

I would like to place a "CallingMethod" inside of an " if " loop

lyn flick
Greenhorn

Joined: Jun 25, 2011
Posts: 4
I want to use a "CallingMethod" inside of an " if " loop in order to access and execute a different .class. Is this possible, if so could you give me a simple example code??
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 37926
    
  22
What's a CallingMethod? Do you mean you want to invoke a method?
fred rosenberger
lowercase baba
Bartender

Joined: Oct 02, 2003
Posts: 11153
    
  16

Can you be more clear on what you mean? what is a "CallingMethod"? also, you don't execute a classs... you can execute methods of a class, if that's what you mean. If they are static, you can simply call them. If not, you need a reference to the object.


There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 37926
    
  22
I have tested the code in the previous post, but not this most recent class.
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 37926
    
  22
Beat you by 21 seconds, Fred. That's almost up to Rob's standard.
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 37926
    
  22
You don't call them if loops. Let's change the last lot of code.That will randomly show the output or not show it with a 50/50 probability. Again code not tested.
lyn flick
Greenhorn

Joined: Jun 25, 2011
Posts: 4
Okay guys...
I am working on a mortgage calculator for class. I have all of the basic requirements for this week, however I don't care for the way it looks. As it stands right now I have a drop down menu which allows the end user to select a predefined terms combo or select own terms combo. This drop down menu is processed through an Array. The 5th index position is where I would like to call a method from another .class and have this particular if statement process the "own terms" selection. I hope that makes a little more sense!


PS. Is there a way to respond to each of you without submitting a reply to the original post?

Thanks for all the help!
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60764
    
  65

All responses should be posted as replies to this post.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 37926
    
  22
Don't understand the problem. Sorry. What is the difference between element 5 and the others? How can you call something on element 5 and not on the others?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: I would like to place a "CallingMethod" inside of an " if " loop
 
Similar Threads
Array list > for loop or iterator
Nested loop and break
Reading Terminal Input
Re: auto commit within JTS transaction
Eclipse hangs on a redirect from a servlet