Browse tutorials by Category - Logic Error
Array Index Out Of Bounds (Command Line)
Time: 1:29
|
|
| Average: 164 ratings | Your Rating: |
| Categories: Array Runtime Error Logic Error Command Line | |
| Description: click for more...
This video shows the runtime error that results when an index references beyond the end of an array. IT points out that one should always look both at the line number in a runtime error and the index listed in an ArrayIndexOutOfBounds error. This error is fixed by changing the constant index values which are used to index the array. |
|
Array, Off By One Error (BlueJ)
Time: 7:04
|
|
| Average: 161 ratings | Your Rating: |
| Categories: Array Loop Logic Error BlueJ | |
| Description: click for more...
This video shows the problem of code that doesn’t produce the correct output because the loop has an off-by-one error when it processes the array to find an average. |
|
Confusing And and Or (BlueJ)
Time: 5:24
|
|
| Average: 166 ratings | Your Rating: |
| Categories: Conditional Loop Logic Error BlueJ | |
| Description: click for more...
This video shows the incorrect uses of || (or) in a compound boolean expression to control a validation loop. The incorrect boolean expression matches with commonly used English “if the user doesn’t answer ‘yes’ or the user doesn’t answer ‘no’ then make them type in another answer.” This expression is complicated by the fact that the “not” is used in conjunction with .equals is harder to parse than, for example, !=. |
|
Infinite Loop (BlueJ)
Time: 6:41
|
|
| Average: 185 ratings | Your Rating: |
| Categories: Loop Logic Error Debugging Process BlueJ | |
| Description: click for more...
Shows an infinite loop that occurs due to lack of update of a loop iterator inside an if statement in the loop. It identifies that an infinite loop is happening when the program does not seem to end. It then shows how to insert print statements to output the iterator value at the beginning of the loop, and then again at the end of the loop. |
|
Infinite Loop (Eclipse)
Time: 5:09
|
|
| Average: 165 ratings | Your Rating: |
| Categories: Loop Logic Error Debugging Process Eclipse | |
| Description: click for more...
Shows an infinite loop that occurs due to lack of update of a loop iterator inside an if statement in the loop. It identifies that an infinite loop is happening when the program does not seem to end. It then shows how to insert print statements to output the iterator value at the beginning of the loop, and then again at the end of the loop. |
|
Instance Variable Masking (Eclipse)
Time: 3:46
|
|
| Average: 191 ratings | Your Rating: |
| Categories: Logic Error Classes Eclipse | |
| Description: click for more...
Shows what happens when a local variable in a method has the same name as an instance variable in your class and provides 2 ways to fix this problem (instance variable masking). |
|
Linear Search of an Array (Eclipse)
Time: 9:08
|
|
| Average: 175 ratings | Your Rating: |
| Categories: Conditional Array Loop Logic Error Debugging Process Eclipse | |
| Description: click for more...
This video shows a program which is searching through an array, in a linear fashion, looking for a value. It has an if…else statement within a loop which assigns a boolean value to a variable called “found” every iteration of the loop (if theArray[index] == value). It shows that the code works for any value not in the array, but that it always reports “found” to be false, even for values that are in the array. By inserting print statements at the start of the if block and then in the else block, it shows that “found” is updated every iteration of the loop, potentially overwriting the assignment of true to “found.” |
|
Missing Input Statement (BlueJ)
Time: 3:12
|
|
| Average: 156 ratings | Your Rating: |
| Categories: Loop Logic Error BlueJ | |
| Description: click for more...
This video shows an infinite loop that occurs due to a lack of an input statement inside a validation loop. A prompt and a scan is used before the loop, but the code inside the loop only has a prompt. It points out the infinite loop and shows the addition of a read statement to fix the problem. |
|
Missing Semicolon ; (BlueJ)
Time: 5:28
|
|
| Average: 160 ratings | Your Rating: |
| Categories: Compile Error Logic Error BlueJ | |
| Description: click for more...
Small method demonstrating syntax error caused by a missing semi-colon. |
|
Multiple Parameters and Return Values (Command Line)
Time: 10:00
|
|
| Average: 146 ratings | Your Rating: |
| Categories: Array Logic Error Command Line | |
| Description: click for more...
This video shows the problem of trying to return a value calculated in a method through a parameter, where the student is assuming that Java parameters are passed by reference. The video shows the process of returning two values from a method and how this can be accomplished with an array. |
|
Parameter Passing (Eclipse)
Time: 2:36
|
|
| Average: 163 ratings | Your Rating: |
| Categories: Logic Error Eclipse | |
| Description: click for more...
Demonstrates the pass by value parameter passing paradigm of Java. Shows how to sum values in an array in a method, passing back the total. This video will be helpful to you if you are passing a parameter to a method, and not getting the value you expect after the method is called. |
|
Static Context (Command Line)
Time: 9:02
|
|
| Average: 155 ratings | Your Rating: |
| Categories: Compile Error Logic Error Classes Command Line | |
| Description: click for more...
The compiler generates a “non-static method X cannot be referenced from a static context” message. Shows what happens when a non-static method is called form the static main method. |
|
String Index Out Of Bounds (BlueJ)
Time: 7:23
|
|
| Average: 167 ratings | Your Rating: |
| Categories: Runtime Error Logic Error Strings BlueJ | |
| Description: click for more...
This video shows a StringIndexOutOfBoundsException caused by indexing beyond the end of a String. This happens in a nested loop, where the inner loop should stop at the end of a word. However, when the end of the string is reached, an erorr is thrown. |
|
String Index Out of Bounds (Command Line)
Time: 3:05
|
|
| Average: 163 ratings | Your Rating: |
| Categories: Runtime Error Logic Error Command Line | |
| Description: click for more...
Shows a program that is counting the number of words in a Java String. The program gets a stack trace that shows a java.lang.StringIndexOutOfBoundsException. The program is run using a Unix command line and a text editor. Demonstrates how to read a stack trace. |
|
String Index Out of Bounds (Eclipse)
Time: 4:37
|
|
| Average: 159 ratings | Your Rating: |
| Categories: Runtime Error Logic Error Eclipse | |
| Description: click for more...
Shows a program that is counting the number of words in a Java String. The program gets a stack trace that shows a java.lang.StringIndexOutOfBoundsException. The program is run using Eclipse. Demonstrates how to read a stack trace. |
|
Page: 1 2