Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes Beginning Java and the fly likes search the word using random characters in java Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "search the word using random characters in java" Watch "search the word using random characters in java" New topic
Author

search the word using random characters in java

zhetha lakshmi
Greenhorn

Joined: Apr 30, 2004
Posts: 3
Hi,

I created some words using string array like elephant ,apple,telephone ..etc. If i given the input like 'e' 'p' 'h' 't' character one by one means, expect the output is "elephant" and "telephone".

Please guide me.

Thanks & Regards,
seetha
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14074
    
  16

First, write down in plain English (or your own native human language) what you think the steps are to find the words that you need to find.

You have a list of words, and a list of letters. What is your program going to do with those two to find the words that match?

Once it's clear what the plan is, you can start thinking about writing it down in Java code.


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
fred rosenberger
lowercase baba
Bartender

Joined: Oct 02, 2003
Posts: 11169
    
  16

zhetha lakshmi wrote:Hi,
I created some words using string array like elephant ,apple,telephone ..etc. If i given the input like 'e' 'p' 'h' 't' character one by one means, expect the output is "elephant" and "telephone".

Why would the expected output be "elephant" and "Telephone"? Why would it not include "apple"?

An example like this is a good START, but it is not a "spec" (or specification). The first step in writing code is understanding the problem. The next step is writing out an algorithm for a solution, as Jesper said.

Until you can do that, there is no point in writing a single line of code.


There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
Winston Gutkowski
Bartender

Joined: Mar 17, 2011
Posts: 7552
    
  18

zhetha lakshmi wrote:I created some words using string array like elephant ,apple,telephone ..etc. If i given the input like 'e' 'p' 'h' 't' character one by one means, expect the output is "elephant" and "telephone".

Why?

When you can explain that in detail and in English (or your native language), you will be a long way towards solving your problem.

Winston

Isn't it funny how there's always time and money enough to do it WRONG?
Articles by Winston can be found here
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: search the word using random characters in java
 
Similar Threads
Great Quotes
How to add JPA ManyToMany records?
Microsoft buying Yahoo ?
Simple regex question
Favorite animal in the zoo