I am trying to save the value of an int that my server gets from the client to a stack but do not know where to begin or what to do.
public class ser {
public static int number, temp;
public static void main(String args[]) throws UnknownHostException, IOException
{
ServerSocket s1=new ServerSocket(1342);
Socket ss = s1.accept();
Scanner sc = new Scanner (ss.getInputStream());
number = sc.nextInt();
temp = number*2;
PrintStream p=new PrintStream(ss.getOutputStream());
p.println(temp);
}
}
I want the temp to be saved in a stack.
Any help will be appreciated.