How do you type cast the returned value of a method so that you can avoid creating a temporary variable. Here's an example:
I know that the component returned by panel.getComponent(i) will be of type OnOffButton. I want to avoid:
OnOffButton btn = (OnOffButton) panel.getComponent(i); btn.setState('0');
Is there a way around this?
You may try following code:
((OnOffButton) panel.getComponent(i); btn.setState('0')).setState('0');
That doesn't work. (Also, i'm trying to avoid creating the btn variable in the first place).
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.