online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code    Language
// Java code for stack implementation import java.io.*; import java.util.*; class Main { // Question1: create stack list static Stack<Integer> stack_create() { return new Stack<Integer>(); } // Question2: Display the stack static void stack_display(Stack<Integer> stack) { System.out.println("Elements on stack: " + stack); } // Question3: count size of the stack static void stack_count(Stack<Integer> stack) { System.out.println("Size of the stack is: " + stack.size()); } // Question4: Insert new nodes on the stack static void stack_push(Stack<Integer> stack) { Scanner sc = new Scanner(System.in); System.out.print("Input the number of nodes: "); int N = sc.nextInt(); for(int i = 0; i < N; i++) { System.out.print("Input data for node " + (i+1) + ": "); stack.push(sc.nextInt()); } } // Question5: remove nodes from the stack static void stack_pop(Stack<Integer> stack) { Integer y = (Integer) stack.pop(); System.out.println("the node which has the value " + y + " is removed"); } public static void main (String[] args) { Stack<Integer> stack = new Stack<Integer>(); stack_push(stack); stack_pop(stack); stack_count(stack); stack_display(stack); } }

Compiling Program...

Command line arguments:
Standard Input: Interactive Console Text
×

                

                

Program is not being debugged. Click "Debug" button to start program in debug mode.

#FunctionFile:Line
VariableValue
RegisterValue
ExpressionValue