Results 1 to 3 of 3
- 02-16-2010, 12:08 AM #1
Member
- Join Date
- Jan 2010
- Posts
- 36
- Rep Power
- 0
operator || cant be applied to OlimpicFrog, boolean
Hi
I cant compile my code cause of error:
"operator || cant be applied to OlimpicFrog, boolean"
Error is in method:
Java Code:/** * * Moves to the home position and then moves right by the number of times indicated by the class constant RUN_UP, * Performs a jump; Next Increments the receiver’s medalCount by one and then checks the value of the class variable currentLeader. * (To become the current leader, an OlympicFrog must have more medals than the current title holder. * So if currentLeader is null or ifcurrentLeader references an instance of OlympicFrog whose medalCount isless than the receiver’s, * then the method should set currentLeader to the receiver.) */ public void jump() { super.home(); for (int move = 0; move < OlympicFrog.RUN_UP; move++) { super.right(); } super.jump(); this.incrementMedalCount(); if ((OlympicFrog.currentLeader = null) || (this.getMedalCount() > OlympicFrog.currentLeader.getMedalCount())) { this.OlympicFrog = OlympicFrog.currentLeader; } }
- 02-16-2010, 12:20 AM #2
You want the equality operator (==) instead of the assignment operator (=).Java Code:(OlympicFrog.currentLeader [b]=[/b] null)
- 02-16-2010, 12:37 AM #3
Member
- Join Date
- Jan 2010
- Posts
- 36
- Rep Power
- 0
Thank you. That helped but now I have another error in that method in statement:
Error says:Java Code:this.OlympicFrog = OlympicFrog.currentLeader;
Cannot find symbol - variable OlympicFrog
What I am trying to achieve in that statement is to set currentLeader to the receiver but I'm not sure how to do that.
Similar Threads
-
Operator < cannot be applied to java.lang.Object, Object
By Albert in forum Advanced JavaReplies: 2Last Post: 11-26-2010, 02:12 AM -
[SOLVED] operator / cannot to applied to java.lang.string,int
By tpyq in forum NetBeansReplies: 3Last Post: 12-01-2008, 05:40 AM -
Error Message: operator * cannot be applied to java.lang.String, int
By MICHAELABICK in forum Java AppletsReplies: 4Last Post: 11-27-2008, 06:09 AM -
Error: cannot be applied to (java.lang.String)
By carl in forum New To JavaReplies: 1Last Post: 08-05-2007, 06:33 AM -
Error: javax.swing.AbstractButton cannot be applied to...
By barney in forum AWT / SwingReplies: 1Last Post: 08-01-2007, 06:10 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks