aspose file tools*
The moose likes Beginning Java and the fly likes trapping two appearance of a character Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "trapping two appearance of a character" Watch "trapping two appearance of a character" New topic
Author

trapping two appearance of a character

joseph okon
Ranch Hand

Joined: Dec 07, 2004
Posts: 63

pls don't laught ! can't think of any stuff to make it work

[fbr - added code tags]
[ December 11, 2007: Message edited by: Fred Rosenberger ]
Joanne Neal
Rancher

Joined: Aug 05, 2005
Posts: 3456
    
  12
Originally posted by joseph okon:

pls don't laught ! can't think of any stuff to make it work

[fbr - added code tags]

[ December 11, 2007: Message edited by: Fred Rosenberger ]


One error I can see is that you are trying to use equals to compare two integers. Primitive data types (such as int) don't have methods. You need to use == to compare them.

Fix that and if it still doesn't compile, post the error messages you are getting (exactly as they appear). Once it's compiling we can then tackle the logic.


Joanne
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41574
    
  54
I've made a few modifications -marked in bold- to help you get going. What's missing is the spot labelled "TODO". What needs to happen there to make the code work?


Ping & DNS - my free Android networking tools app
Shane W
Ranch Hand

Joined: Aug 31, 2007
Posts: 30
Hi
As pointed out by folks above, there are some erroes in your code.Find below a simple piece of code that achieves what your code would have(more than 2 @).I have done away with the countChar method.
Incase you want to count how many times "@" appears,you need to modify countChar method



Shane
joseph okon
Ranch Hand

Joined: Dec 07, 2004
Posts: 63
thanks guys, i have gotten the right answer to my code
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: trapping two appearance of a character