import java.util.Scanner;

public class stack {

/**
 * @param args

 */
public static void main(String[] args) {


     int result  ;
     int output   ;
     Scanner num = new Scanner(System.in);
     int input = num.nextInt();

     for(int j = 0;j<input;j++)
     {
         int output1 = 0;
          output = num.nextInt();

          for(int i = 0;i<output;i++)
          {

          if(output == 1 - 3000){
             output =  output1;
              return;

          }
           if(output!=1-3000){

            if(output ==('+')){
                  result = (output1 + output1);
                result++ ;
                System.out.println(result); 
             }
            else   if(output==('-')){
                     result = (output - output);
                     result++;
                        System.out.println(result); 
             }

            else if(output == ('*')){
                     result = (output * output);
                        result++;
                        System.out.println(result); 
             }
      }
          }
}
}
}

Please Tell me
Why error.
input

9
7 2 – 5 2 * 36 - *

output

-130

Why not?
(Post code indented and with code=java tags and explain why the output is wrong - ie what did you expect?)

I understood what you are trying to do but I think you should write it again. because it wont work. ok here how you should write it.
1 ) make a loop that turns until there is no token left on scanner.

for(int j = 0;j<input;j++)

and this is not it. input variable stores first interger token. which is 7 so it will loop 7 times
2) if next token is number put next token in stack if it is not number it shuld be + - * or / then pop 2 number from stack and do the calculation and put result back in stack.at the and you should have only one. number and it will be result.
note) if at the end ,there is more than one number in stack given string is not valid. when you got an operator from scanner and there is less than two number in stack string is not valid. and if string you got is not number nor operator string is not valid. good luck.
(

if(output == 1 - 3000)

I dont know what this is and you probably dont know what this is either.this is same thing as

if(output ==-2999)
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.