type mismatch cannot convert from element type object to string

后端 未结 4 483
日久生厌
日久生厌 2021-01-14 22:15

I keep getting this error when making a search method in my code to search through string. I have gone through alot of examples trying to fix this but I cant find any. Thank

4条回答
  •  死守一世寂寞
    2021-01-14 22:47

    Add notes as a global variable to your class

    public class Notebook{
    ArrayList notes = null;
    
    ....
    }
    

    In the constructor, do:

    public Notebook()
    {
        notes = new ArrayList();
    }
    

提交回复
热议问题