i need help

i'm new to java and i'm using codeworrior

i have to make a dictionary that find all the words that have the second letter as the users enter in the application

for example: if i want all the words that have A as a second letter to appear on the screen . .

i have to tokenize the line and check if it is at least 2 letters i'm having difficulities to check if it is at leat 2 letters

please help ASAP

thanx

Fatima

[458 byte] By [aLwEjDaNa] at [2007-10-2 3:56:47]
# 1
Have you checked? String.length();
matsebca at 2007-7-15 23:18:12 > top of Java-index,Java Essentials,Java Programming...
# 2

i don't know how to do it that's what i did

while(count < MAX_CAPACITY && oneline != null)

{

StringTokenizer st = new StringTokenizer(oneline, " ");

while(count < MAX_CAPACITY && st.hasMoreTokens())

{

word = st.nextToken();

if (word.charAt(1) == lookup);

{

list[count] = word;

count++;

}

}

aLwEjDaNa at 2007-7-15 23:18:12 > top of Java-index,Java Essentials,Java Programming...
# 3
if(oneline.length()>1)that indicates that the string has more than one letter
matsebca at 2007-7-15 23:18:12 > top of Java-index,Java Essentials,Java Programming...
# 4
http://java.sun.com/j2se/1.4.2/docs/api/java/lang/String.html
matsebca at 2007-7-15 23:18:12 > top of Java-index,Java Essentials,Java Programming...
# 5
i can't do thatit gives me an error that can't convert char to boolean
aLwEjDaNa at 2007-7-15 23:18:12 > top of Java-index,Java Essentials,Java Programming...
# 6

please help i'm still having the problem !!

how do i tell the computer to check if the word is at least two char.

when i start my application the user have to enter the file name

then enter a letter to be used as a filter (which we should make it the second letter) in order to search what is the second letter is i have to make sure that the word should be 2 letters please help

this is really importatnt

this is part of my lab:(please show me where to write the code and what is it i've been working on this lab for 2 weeks and i didn't figur it yet . . i have to submit it after few days please help cause this is the only part that is missing and i spend to much time on it and i don't want to lose points its really a huge programe )

public static void main (String[] args)

{

try

{

list = new String[MAX_CAPACITY];

String oneline;

count = 0;

String one_word;

BufferedReader keyboard = new BufferedReader(new InputStreamReader(System.in));

System.out.print("Enter the name of the file: ");

System.out.flush();

String fileName = keyboard.readLine();

BufferedReader inFile = new BufferedReader(new FileReader(fileName));

System.out.print("Enter a letter to be used as a filter: ");

System.out.flush();

oneline = keyboard.readLine();

char filter1 = oneline.charAt(0);

//reading the file

oneline = inFile.readLine();

while(count < MAX_CAPACITY && oneline != null)

{

StringTokenizer st = new StringTokenizer(oneline, " ");

while(count < MAX_CAPACITY && st.hasMoreTokens())

{

one_word = st.nextToken();

if(one_word.charAt(one_word.lcharAt(1)) == filter1)

{

list[count] = one_word;

count++;

}

}

oneline = inFile.readLine();

}

inFile.close();

aLwEjDaNa at 2007-7-15 23:18:12 > top of Java-index,Java Essentials,Java Programming...
# 7

> how do i tell the computer to check if the word is at

> least two char.

This has been told to you.

Again: String.length()

So before you add one_word to you list, do something like this:

if(one_word.length() >= 2) {

list[count] = one_word;

count++;

}

prometheuzza at 2007-7-15 23:18:12 > top of Java-index,Java Essentials,Java Programming...