Hello everyone I am making a code to create a fractal using the turtle class in java. The problem is that the fractal string doesn't seem to be registering through the if and else if statements. What I would like to know is if that is the problem...or something else...Thanks

/**
 * This program is suppose to create a fractal
 *
 * @author Troyle Thomas
 * @version 08/19/10
 */
import java.awt.*;
class FractalEngine
{
    World world = new World(700,700); 
    Turtle turt = new Turtle(1,1,world);
    
    public void drawFractal(String rule)
    {
        turt.penUp();
        turt.moveTo(350,350);
        
        int lenofRULE = rule.length();
        
        int start = 0;
        int fin = 1;
        String tinyChar;

        
        for(int a = 0; a <= lenofRULE; a++)
        {
            if(start == 9)
                tinyChar = rule.substring(start);
            else 
                tinyChar = rule.substring(start,fin);
                
            if(tinyChar == "F")
                turt.forward(25);
            else if(tinyChar == "-")
                turt.turnLeft();
            else if(tinyChar == "+")
                turt.turnRight();
            else
                break;
            start++;
            fin++;
                
            System.out.println(tinyChar);
        }
    }
}
public class FractalEngineTester
{
    public static void main(String[] args)
    {
       FractalEngine fEng = new FractalEngine();
       
       String rule = "F-F+F+F-F";
       
       fEng.drawFractal(rule);
       //String rule = "F-F+F+F-F-F-F+F+F-F+F-F+F+F-F+F-F+F+F-F-F-F+F+F-F";
       //String rule = "F-F+F+F-F-F-F+F+F-F+F-F+F+F-F+F-F+F+F-F-F-F+F+F-F-F-F+F+F-F-F-F+F+F-F+F-F+F+F-F+F-F+F+F-F-F-F+F+F-F+F-F+F+F-F-F-F+F+F-F+F-F+F+F-F+F-F+F+F-F-F-F+F+F-F+F-F+F+F-F-F-F+F+F-F+F-F+F+F-F+F-F+F+F-F-F-F+F+F-F-F-F+F+F-F-F-F+F+F-F+F-F+F+F-F+F-F+F+F-F-F-F+F+F-F";
    }
}
This article has been dead for over six months. Start a new discussion instead.