Here is the code I have so far and when I compile it I get errors

import java.util.Scanner;

public class Bible2a
    public static void main ( String [] args )throws FileNotFoundException
        Scanner dataFile=new Scanner(new File("test.txt"));

        /*int colonPosition = verse.indexOf(':');*/
                String verse = dataFile.nextLine();
                verse = verse.toLowerCase ();
                int colonPosition = verse.indexOf(':');
                int verseLenght = verse.lenght();
                for (int current = (colonPosition + 1); (current <= (verseLenght - 1)); ++ current);
                System.out.println("Print Verse = " + verse);
        /*for (int current = (colonPosition + 1);*/



Here is what the error says:

symbol  : method lenght()
location: class java.lang.String
                int verseLenght = verse.lenght();

Recommended Answers

All 4 Replies

It is "length()" not "lenght()" :)

Thank you I think that fixed it

Please mark the thread as solved. :)

Can you please tell me how to do that?

Be a part of the DaniWeb community

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