Speak now
Please Wait Image Converting Into Text...
Embark on a journey of knowledge! Take the quiz and earn valuable credits.
Challenge yourself and boost your learning! Start the quiz now to earn credits.
Unlock your potential! Begin the quiz, answer questions, and accumulate credits along the way.
General Tech Learning Aids/Tools 2 years ago
Posted on 16 Aug 2022, this text provides information on Learning Aids/Tools related to General Tech. Please note that while accuracy is prioritized, the data presented might not be entirely correct or up-to-date. This information is offered for general knowledge and informational purposes only, and should not be considered as a substitute for professional advice.
Turn Your Knowledge into Earnings.
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:
public int getX() { return x; }
Method that I want to use that variable in to assign, (with my terribly poor attempt) in MyClass:
public void establishIrEvent(IREvent arg0) { int source = (IREvent)arg0.getX(); }
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.
There are a couple of problems with your code. First, you are trying to assign an int to a Stringbecause getX returns int and the source variable is a String. if you want to do this, then try :
int
String
getX
source
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.
arg0
IREvent
establishIrEvent
No matter what stage you're at in your education or career, TuteeHub will help you reach the next level that you're aiming for. Simply,Choose a subject/topic and get started in self-paced practice sessions to improve your knowledge and scores.
General Tech 9 Answers
General Tech 7 Answers
General Tech 3 Answers
General Tech 2 Answers
Ready to take your education and career to the next level? Register today and join our growing community of learners and professionals.