Results 1 to 3 of 3
  1. #1
    chmo is offline Member
    Join Date
    Nov 2010
    Posts
    3
    Rep Power
    0

    Post want help about ArrayList and interaction

    Firstly... I am a new in Java...
    I have a music dictionary that use an arreylist to store the terms and definition
    The user use the terminal to interact with this dictionary.

    Java Code:
    private void addTerms () 
        {
            addTerm("Anathema","Atmosheric metal band from Liverpool, UK."
    }
    Because, I would like to make it more sophisticated, if someone write not a band but a letter eg A or B or C then the dictionary to give him as feedback all the bands that their first letter is A or B or C.

    I am trying to do this with substring(0,1).
    eg.

    if (band.substring(0,1) = bandExists(band).substring(0,1)
    {
    System.out.println(i dont know what to print!!!!)
    }

    and another question...

    if it works, and prints the bans names that their first letter is "A"

    1. Agathodemon
    2. Anathema
    3. Annihilator
    etc

    how possible is to write a number eg 3 and to print out now the definition of the band?

  2. #2
    j2me64's Avatar
    j2me64 is offline Senior Member
    Join Date
    Sep 2009
    Location
    Zurich, Switzerland
    Posts
    962
    Rep Power
    6

    Default

    Quote Originally Posted by chmo View Post
    how possible is to write a number eg 3 and to print out now the definition of the band?
    sure, usually the desired string of an object is specified in the class itself by the method toString(). can you post your classes?

  3. #3
    KevinWorkman's Avatar
    KevinWorkman is offline Crazy Cat Lady
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    3,969
    Rep Power
    8

    Default

    One thing at a time. Post the actual code you're trying to use, in SSCCE form. What you posted won't compile, and wouldn't work even if it did.

Similar Threads

  1. GUI interaction
    By Glyph in forum New To Java
    Replies: 6
    Last Post: 10-19-2010, 07:43 PM
  2. Java interaction
    By satimis in forum New To Java
    Replies: 4
    Last Post: 06-30-2010, 05:14 PM
  3. Interaction with File System
    By Italian_Programmer in forum AWT / Swing
    Replies: 2
    Last Post: 03-08-2010, 10:11 AM
  4. program interaction possible?
    By Pierced1 in forum Advanced Java
    Replies: 3
    Last Post: 02-19-2009, 12:54 AM
  5. Object Interaction
    By Jinxes in forum New To Java
    Replies: 1
    Last Post: 12-03-2007, 12:05 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •