Error message "Type result cannot be resolved or is not a field"
Code java:
package kata_packages;
import java.awt.List;
import java.util.Arrays;
import java.util.LinkedList;
class _kata1 {
/**
* This method should iterate over the {@link words} list and look for words
* that are anagrams of one another. The method should return a list of
* words which are anagrams, discarding the rest.
*
* For example, if the {@link words} list contains the words "act", "cat"
* and "dog" then the method should return a list containing "act" and
* "cat".
*
* HINT: You can use your own code from previous katas if you wish.
*
* @param words
* a list of words to look through for anagrams
* @result a list of words which are anagrams of each other
*/
public static List<String> findAllAnagrams(List<String> words) {
/* TODO: Write the code for this method! */
return null;
}
}
public class Kata1 {
private static final String[] _WORDS = { "aardvark", "act", "bat", "cat",
"dent", "tab", "tac", "sat", "sad" };
private static final List<String> WORDS = new LinkedList<String>(
Arrays.asList(Kata1._WORDS));
private static List<String> result = null;
@Before
public void setUp() throws Exception {
Kata1.result = _kata1.findAllAnagrams(Kata1.WORDS);
}
@Test
public final void testAnagrams() {
Assert.assertTrue(Kata1.result.contains("act"));
Assert.assertTrue(Kata1.result.contains("bat"));
Assert.assertTrue(Kata1.result.contains("cat"));
Assert.assertTrue(Kata1.result.contains("tab"));
Assert.assertTrue(Kata1.result.contains("tac"));
}
@Test2
public final void testNotAnagrams() {
Assert.assertFalse(Kata1.result.contains("aardvark"));
Assert.assertFalse(Kata1.result.contains("dent"));
Assert.assertFalse(Kata1.result.contains("sat"));
Assert.assertFalse(Kata1.result.contains("sad"));
}
@Test
public final void testNotNull() {
Assert.assertNotNull(Kata1.result);
}
}
on the Assert.assert and Kata1.result.contains I keep getting Type result cannot be resolved or is not a field error message and I am not sure on how to proceed any help will be greatly appreciated
many thanks
James
Re: Error message "Type result cannot be resolved or is not a field"
Please post the full text of the compiler's error message so we can see where the error is and all the information about the error.
Please edit the post and fix the formatting of the code. All statements should NOT start in the first column. Nested statements should be indented 3-4 spaces.
The posted code does not compile with the javac compiler.