Answer:
The function is simple, seeing the condition, as it is the array list and not array. An array list provides a size method, and this can be much awesome here.
public int fileSize()
{
TextFile t1=new Textfile();
int size= t1.words.size();
return size;
}
Step-by-step explanation:
We are creating an instance of a class here for working on word ArrayList. The ArrayList has a size method in java. And hence we can use that above to find the size of the ArrayList. Also remember words is a private varianle here, and hence it should be called from within the class,to ensure its within the scope.