Im getting this error for a code
MainStocks.java:66: error: cannot find symbol boolean tf = stockName.contains(stName); ^ symbol: method contains(String) location: variable stockName of type String[]
class watchList extends Stocks
{
public void watchList()
{
System.out.println("Enter Stock Name: ");
String stName = sc.nextLine();
stName = stName.toUpperCase();
boolean tf = stockName.contains(stName);
for(int i=1;i<=16;i++)
{
if (tf == true)
{
display(i);
}
else
{
System.out.println("Stock Not Found!");
}
}
}
}
class MainStocks
{
public static void main(String[] args) {
watchList obj = new watchList();
obj.watchList();
}
}
i tried importing some java utils using some other forum chats, but could’nt figure out how to work around it.
New contributor
atharva patil is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.