i am new to java and i am getting"cannot find symbol-variable data"please help here is my code

import java.io.*;
class categories
{
void options()throws IOException
{
int a;
System.out.println("The categories available are");
System.out.println("1.Fantasy");
System.out.println("2.Fiction");
System.out.println("3.Inspirational");
System.out.println("4.Mystery");
System.out.println("5.Comics");
System.out.println( );
System.out.println("enter your choice");
data=stdin.readLine();
a=Integer.parseInt(data);
switch(a)
{
case 1:System.out.println("1.The vampie academy series" );
System.out.println("2.The Percy jackson series");
System.out.println("3.The Marked series");
System.out.println("4.The Airhead series");
break;
case 2:System.out.println("1.The Harry potter series");
System.out.println("2.The Girl with the Dragon tatoo series");
System.out.println("3.The Mediator series");
System.out.println("4.The Twilight series" );
break;
case 3:System.out.println("1.Unposted letters");
System.out.println("2.The Monk who sold his Ferrari series");
System.out.println("3.The Chicken soup series");
System.out.println("4.Frozen thoughts");
break;
case 4:System.out.println("1.The Hardy boys series");
System.out.println("2.The Nancy Drew series");
System.out.println("3.The Sherlock Homes series");
System.out.println("4.The Tin-Tin series");
break;
case 5:System.out.println("1.Archie");
System.out.println("2.Garfield");
System.out.println("3.Calvin and Hobbes");
System.out.println("4.Batman");
break;
default:System.out.println("books in this category not available");
}
}
void me()
{
int n;
System.out.println("Thank you for using Just reads services ");
System.out.println("Would you like to borrow more books?");
System.out.println("Enter your choice");
data=stdin.readLine();
n=Integer.parseInt(data);
if(n=="Yes")
{
int z=obj.options();
}
else
{
int z=obj. bill();
}
}
void bill()
{
System.out.println("bill");
}


public static void main (String args[])throws IOException
{
InputStreamReader instream=new InputStreamReader(System.in);
BufferedReader stdin=new BufferedReader(instream);
obj.categories=new categories();
obj.options();
obj. me();
obj. bill();
}
}
data=stdin.readLine();

you do use this variable, but you never declared it.

add

String data;

in class scope.

here you have done one mistake.
i think you have written wrong at line 55:

you have convert n into Integer and you are comparing it with string.So, here is incompatible types.(Matching integer with string)

Also problem at line 74:
you have write obj.categories, i think you have to create object of categories class.

I just had a closer look:
your code is bad, and filled with errors.

you haven't declared your stdin either. so, I just assumed that would be a Scanner, but even if you declare it, there is no readLine() method.

indeed, also, comparing a String to an Integer. even if it were two Strings, never EVER compare the value of two objects using the == comparator. always use the .equals() method.

and yup, that obj... what is that supposed to be?

Be a part of the DaniWeb community

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