I want to ask the size of the array from the user. If the user does not enter the size and press the enter button, I want to use array size as 10 (default value). I am not able to do it. Here is my simple java code.
System.out.print("Enter the size of Stack: "); int size = sc.nextInt();
Check out the image for reference.
I am a beginner in java.
