| | |
solvetion of my code.
Please support our Java advertiser: Programming Forums - DaniWeb Sister Site
![]() |
•
•
Join Date: Jul 2004
Posts: 16
Reputation:
Solved Threads: 0
hello,
i just start learning java.please solve my following problem:
Q: Write a simple program that allows a user to push up to ten names onto a stack as well as popping them off the stack.
my code is:
import DataStructures.*;
public class StackDemo {
public static void main(String[] args) {
stack a = new StackArray();
for (int i = 0; i < 10;i++) {
s.push(new Integer(i));
}
while (!s.isEmpty()) {
System.out.println(s.pop());
}
}
}
it is not running properly.other question is if i want to enable other data types such as an int, float, double and char to be pushed into the stack what changes do i need to make? and if i want to do the same program to a Queue what i have to do?
please try to solve my problem as soon as possible. it's urgent. thank you for helping me.
shantuli :o
i just start learning java.please solve my following problem:
Q: Write a simple program that allows a user to push up to ten names onto a stack as well as popping them off the stack.
my code is:
import DataStructures.*;
public class StackDemo {
public static void main(String[] args) {
stack a = new StackArray();
for (int i = 0; i < 10;i++) {
s.push(new Integer(i));
}
while (!s.isEmpty()) {
System.out.println(s.pop());
}
}
}
it is not running properly.other question is if i want to enable other data types such as an int, float, double and char to be pushed into the stack what changes do i need to make? and if i want to do the same program to a Queue what i have to do?
please try to solve my problem as soon as possible. it's urgent. thank you for helping me.
shantuli :o
![]() |
Similar Threads
- Code Snippet: Sample code for taking user input from Shell (Java)
- Code Snippet: code to split (and reconnect) an Access database (part 1) (Visual Basic 4 / 5 / 6)
- Code Snippet: Strings: Looking at ASCII Code (C)
- Code Snippet: Morse Code (C)
- Code Snippet: Gray Code Conversion (C)
- Code Snippet: code to validate data in Access withOUT using messageboxes (Visual Basic 4 / 5 / 6)
- Code Snippet: code to split (and reconnect) an Access database (part 2) (Visual Basic 4 / 5 / 6)
- Code Snippet: Send HTML code to Internet Explorer from basic (Legacy and Other Languages)
Other Threads in the Java Forum
- Previous Thread: IO and Embedded SQL
- Next Thread: what is the problem with this app
Views: 1486 | Replies: 1
| Thread Tools | Search this Thread |
Tag cloud for Java
android api apple applet application apps arguments array arrays automation awt binary bluetooth businessintelligence busy_handler(null) card chat class classes client code collision component constructor database draw eclipse error event eventlistener exception file fractal game givemetehcodez graphics gui helpwithhomework html ide image input integer j2me jar java javafx javamicroeditionuseofmotionsensor javaprojects jmf jni jpanel jtree julia link linux list loop machine map method methods mobile netbeans newbie nls number object oracle parsing plazmic print problem program programming project recursion scanner screen server set sharepoint size smart sms socket sort sortedmaps sql string swing test textfield threads time transfer tree unlimited webservices windows







