Comment on Tutorial - Stack example in Java - push(), pop(), empty(), search() By Henry



Comment Added by : hetal

Comment Added at : 2012-02-03 08:47:39

Comment on Tutorial : Stack example in Java - push(), pop(), empty(), search() By Henry
Hi Thanks for this example but i need more help for the following program:
int n = 4;
StackInterface<Integer> myStack = new LinkedStack<Integer>();
while (n > 0)
{
myStack.push(n);
n--;
} // end while

int result = 1;
while (!myStack.isEmpty())
{
int integer = myStack.pop();
result = result * integer;
} // end while
System.out.println("result = " + result);

a. What value is displayed when this code executes?

b. What mathematical function does the code evaluate?


View Tutorial



Related Tutorials

Program using concept of byte long short and int in java

Update contents of a file within a jar file

Tomcat and httpd configured in port 8080 and 80

Java File

Java String

Count number of vowels, consonants and digits in a String in Java

Reverse a number in Java

Student marks calculation program in Java

Handling Fractions in Java

Calculate gross salary in Java

Calculate average sale of the week in Java

Vector in Java - Sample Program

MultiLevel Inheritance sample in Java

Multiple Inheritance sample in Java

Java program using Method Overriding

Archived Comments

1. Thanks for the above description, but pls let me k
View Tutorial          By: Amit Goyal at 2009-09-25 05:33:10

2. This site is an Excellent Choice for lerners.Thank
View Tutorial          By: Sravanthi at 2011-06-28 06:20:35

3. great work
View Tutorial          By: Dinesh557 at 2008-09-25 00:27:59

4. its great!!!!
View Tutorial          By: safrgdg at 2015-02-12 10:10:07

5. so how can i run this project
View Tutorial          By: milinda at 2010-12-17 10:01:23

6. nice tutorial,but if provided with the complete ex
View Tutorial          By: Prasant Kumar Sahu at 2013-01-07 13:17:20

7. What is the exact meaning for the symbol of java?<
View Tutorial          By: Aravind at 2013-06-24 10:52:28

8. this code works for incoming call but not for inco
View Tutorial          By: iman at 2013-08-20 16:21:48

9. good quick explanation. Thanks
View Tutorial          By: kay at 2008-12-08 21:10:13

10. send me the code with complete set of java package
View Tutorial          By: meena at 2011-06-15 03:12:17