I got error :At the constructor MyStackThreads "class , interface or enum expected"
import java.util.*;
import java.io.*;
class MyStackThreads extends Thread
{
Stack thestack= new Stack();
String expression;
String splitexpr[];
MyStackThreads[j]
{
public void run()
{
try
{
DataInputStream dis=new DataInputStream(System.in);
expression=dis.readLine();
for(int i=0;i<expression.length();i++)
{
splitexpr=expression.split(expression);
thestack.push(splitexpr[i]);
}
}
catch(IOException i)
{
System.out.println("error in console io");
}
}
}
MyStackThreads[j]
{
public void run()
{
System.out.println(thestack);
}
}
MyStackThreads[j]
{
public void run()
{
System.out.println("popping out the top");
thestack.pop();
}
}
}
public class StackThread
{
public static void main(String args[]) throws IOException
{
String exit="tata" ;
String user_exit="null";
int user_choice;
int j;
MyStackThreads[] threadobj= new MyStackThreads[3];
while(exit.equalsIgnoreCase(user_exit))
{
System.out.println("what operation do you wanna do with stack");
System.out.println("Enter the appropiate key below");
System.out.println("1-insert 2-evaluate 3-display or type tata ");
DataInputStream dis = new DataInputStream(System.in);
user_choice=dis.readInt();
if(user_choice==1)
{
j=0;
threadobj[j].start();
}
else if (user_choice ==2)
{
j=1;
threadobj[j].start();
}
else if (user_choice ==3)
{
j=2;
threadobj[j].start();
}
else
{
System.out.println("user has assigned nothing.May sign out ");
}
}
}
}