Results 1 to 13 of 13
- 01-06-2010, 10:00 AM #1
Member
- Join Date
- Jul 2009
- Posts
- 18
- Rep Power
- 0
- 01-06-2010, 10:03 AM #2
In how many more forums are you going to post that same question?
Math problems? Call 1-800-[(10x)(13i)^2]-[sin(xy)/2.362x]
The Ubiquitous Newbie Tips
- 01-06-2010, 11:44 AM #3
Member
- Join Date
- Jan 2010
- Posts
- 26
- Rep Power
- 0
Now assume do it without the String libraries and assume the string is a c string.
- 01-06-2010, 01:04 PM #4
Senior Member
- Join Date
- Aug 2008
- Posts
- 384
- Rep Power
- 5
- 01-06-2010, 02:03 PM #5
Member
- Join Date
- Jul 2009
- Posts
- 18
- Rep Power
- 0
hi satheesh.,
i could not get your code yar... can you explain it pls
- 01-06-2010, 02:09 PM #6
Senior Member
- Join Date
- Aug 2009
- Posts
- 2,388
- Rep Power
- 6
Why did you abandon your other thread?
How to count occurences of charectors in string?
Was it because you were asked to write the code for a change?
- 01-06-2010, 02:12 PM #7
- 01-07-2010, 02:22 AM #8
Senior Member
- Join Date
- Nov 2009
- Posts
- 235
- Rep Power
- 4
I'm pretty sure I read a java tutorial on this on Sun's website. If you are looking for code, it might be there.
Nvm, found it.
From The Map Interface (The Java™ Tutorials > Collections > Interfaces)Java Code:import java.util.*; public class Freq { public static void main(String[] args) { Map<String, Integer> m = new HashMap<String, Integer>(); // Initialize frequency table from command line for (String a : args) { Integer freq = m.get(a); m.put(a, (freq == null) ? 1 : freq + 1); } System.out.println(m.size() + " distinct words:"); System.out.println(m); } }
- 01-07-2010, 06:15 AM #9
Senior Member
- Join Date
- Aug 2009
- Posts
- 2,388
- Rep Power
- 6
- 01-07-2010, 07:24 AM #10
Senior Member
- Join Date
- Nov 2009
- Posts
- 235
- Rep Power
- 4
I think it's was pretty obvious that the OP doesn't want to learn and just wants the code(since he started 2 threads asking for "just code"). Besides, hopefully there are parts he doesn't understand and will look those parts up.
- 01-07-2010, 09:06 AM #11
Member
- Join Date
- Jul 2009
- Posts
- 18
- Rep Power
- 0
got the answer. thank u all
String text="satheesh";
text=text.toLowerCase();
int charNum=26; // the number of unique characters
int[] freq=new int[charNum];
for(int i=0;i<text.length();i++) {
freq[text.charAt(i)-'a']++;
System.out.println(text.charAt(i)-'a');
}
for(int i=0;i<charNum;i++) {
System.out.println("Frequency of " + (char) (97 + i) +": " + freq[i]);
}
- 01-07-2010, 09:10 AM #12
Moderator
- Join Date
- Apr 2009
- Posts
- 10,438
- Rep Power
- 16
Or possibly he won't, will still get whatever worthless piece of paper as a qualification, write some utter rubbish in the real world, and I'll have to clean it up...
If he doesn't want to learn then don't give him the opportunity to pass!
- 01-09-2010, 03:23 PM #13
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,375
- Blog Entries
- 7
- Rep Power
- 17
That's one of the reasons it's still such a mess in the ICT world: too many no-goods bluff their way into it, big mouth their way into some stolen/borrowed/copied code and turn everything into one big mess and others have to clean up after those people have gone again.
kind regards,
Jos
Similar Threads
-
to get count value as a variable
By arunkumarinfo in forum JDBCReplies: 2Last Post: 03-30-2009, 01:32 AM -
post count
By codeflip in forum Forum LobbyReplies: 2Last Post: 03-12-2009, 02:20 AM -
[SOLVED] How to count the number of words in a string
By andy5605 in forum New To JavaReplies: 8Last Post: 02-04-2009, 08:55 PM -
How To count the occurnces of astring in another string
By masaka in forum New To JavaReplies: 2Last Post: 05-04-2008, 10:52 PM -
Getting row count
By Java Tip in forum Java TipReplies: 0Last Post: 02-11-2008, 08:49 AM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks