public class ForLoop {
    public static void main(String[] args) {
        String writtenStuff = "Hello i am bucky bucky"; 

        int otherNum = 0; 
        int length = writtenStuff.length();
        int i; 

        for (i = 0; i < length; i++){ 
            if (writtenStuff.charAt(i) == 'b')
                continue; 


        }

    }//end method
}//end class 

Here is my code, and i want to print the string without 'b's. By writing ++otherNum, i can get the number of letters other than b. Now i want to print these letters in order. How can i do this ?

i think i need to create a string for this code, right ?

> if (writtenStuff.charAt(i) == 'b')
>                 continue;

is there anybody to help me ?

If all you're doing is excluding the 'b's then it's as simple as this:

for (i = 0; i < length; i++)
{
    if (writtenStuff.charAt(i) != 'b')
    {
        Console.out.print(writtenStuff.charAt(i));
    }
}

If all you're doing is excluding the 'b's then it's as simple as this:

Thank you. i did not know this way.

I have done what you said. But, it says that Console.out is not visible. What can i do ?

I suspect that's the wrong language! The usual Java version is System.out.println(...

I suspect that's the wrong language! The usual Java version is System.out.println(...

Whoops. Can you tell that I'm a C# guy? ;p

I suspect that's the wrong language! The usual Java version is System.out.println(...

Ohh :) okey guys.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.