•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the Java section within the Software Development category of DaniWeb, a massive community of 374,011 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,831 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Java advertiser: Lunarpages Java Web Hosting
Views: 1140 | Replies: 1
![]() |
•
•
Join Date: Jul 2004
Posts: 16
Reputation:
Rep Power: 5
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
![]() |
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
•
•
•
•
•
•
•
•
DaniWeb Java Marketplace
•
•
•
•
access activation api blogger blogging blogs code com combo dani daniweb data debugging development dreamweaver dropdownlist gdata google gpl html innovation java key linux microsoft microsoft sdk for java microsystems module net news open openbsd platform product programming reuse rss serial software source sun tags vista web wysiwyg xml
- Code 19 Registry Error (Windows NT / 2000 / XP / 2003)
- Why won't this code work? (VB.NET)
- Tutorials & Code Submissions - Questions? (DaniWeb Community Feedback)
- Some Basic Code Hopefully (Help Needed) (HTML and CSS)
Other Threads in the Java Forum
- Previous Thread: IO and Embedded SQL
- Next Thread: what is the problem with this app




Linear Mode