There are a couple of problems with your code. First, you are trying to assign an int
to a String
because getX
returns int
and the source
variable is a String
. if you want to do this, then try :
String source = Integer.toString(arg0.getX());
Second, and less of an issue, there is no need to cast arg0
to IREvent
as it's already defined as that in the establishIrEvent
method.
manpreet
Best Answer
2 years ago
I am still learning but seem to fall at what should be very simple hurdles; my strong points seem to be with the logic of equations but I possess little skill at remembering and implementing functions and correct simple syntax's.
The class that I am implementing the method in is MyClass, the method that I want to define the variable taken from the other class is establishIrEvent. The class that I want to collect the variable from is IREvent, the getter method that returns the variable in this class that I want to collect is getX.
Now for the code:
Getter method from IREvent class:
Method that I want to use that variable in to assign, (with my terribly poor attempt) in MyClass:
Any advice will be hugely appreciated and fingers crossed this question may aid someone else in a similar pickle! Please ask for any more info as I always seem to miss something or ask a question that annoys an experienced developer somewhat.