In: Computer Science
public List<Item> findItems(Lookup query)
{
ArrayList<Item> matches = new ArrayList<Item>();
for (int i = 0 ; i < numItems ; i++ )
{
Item item = items[i];
if (query.matches(item)) {
matches.add(item);
}
}
return matches;
}
"To improve readability, each line of code should be indented under its parent (i.e. methods should be indented under the class, code in methods should be indented under the method, code in if statements should be indented under the if, etc.). This if rcurly is 16 spaces from the margin and it should be at 12 spaces"
I keep getting the error on Eclipse someone please help
As per the code provided above, the if RCurly should be 8 spaces from the margin.
If it is telling you to put 12 spaces, then you must be putting this code inside a class or something.
So, I am providing the screenshot of the code for both the cases.
Screenshot of code if the given code is inside some class:
You can clearly see that, the rcurly of if has only 12 spaces not 16.
NOTE: You you find any difficulty in understanding, feel free to ask.