Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: Error message "Type result cannot be resolved or is not a field"

  1. #1
    Junior Member
    Join Date
    Dec 2012
    Location
    Brighton
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Error message "Type result cannot be resolved or is not a field"

    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


  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,140
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default 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.
    If you don't understand my answer, don't ignore it, ask a question.

Similar Threads

  1. Replies: 3
    Last Post: December 7th, 2011, 02:03 AM
  2. [SOLVED] Error Message: Exception in thread "main" java.lang.NullPointerException etc.
    By coffecupcake in forum What's Wrong With My Code?
    Replies: 5
    Last Post: November 15th, 2011, 09:34 AM
  3. Replies: 10
    Last Post: October 26th, 2011, 02:22 PM
  4. Replies: 7
    Last Post: August 13th, 2011, 01:22 AM
  5. Replies: 4
    Last Post: June 18th, 2009, 09:23 AM