• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Is Stack and push() on the exam?

 
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am using Enthuware and ran across this question.
I did not see this in the objectives for the exam.
I ran across a post on this forum from 2002 about it.

What will the following program print when run?



I'm using K&B SCJP 6 and didn't see any mention of it.
btw the answer is:
[100][]
 
Sheriff
Posts: 9707
43
Android Google Web Toolkit Hibernate IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
As per the objectives its possible as Stack class implements List and the SCJP objectives mentions this

Write code that uses the generic versions of the Collections API, in particular, the Set, List, and Map interfaces and implementation classes.


Stack class itself is actually simple if you know about the interfaces that it implements and if you know the general working of stacks i.e. last in first out (LIFO)...
 
Darren Littlepage
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Ankit.

I think I can learn it quickly as I did a lot of work with Vectors and ArrayLists a few years ago. A few new methods to play with and I should have it down.
 
Bartender
Posts: 6663
5
MyEclipse IDE Firefox Browser Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Darren Littlepage wrote:Thanks Ankit.

I think I can learn it quickly as I did a lot of work with Vectors and ArrayLists a few years ago. A few new methods to play with and I should have it down.



The stack helps at work too. So learn it anyway
 
Enthuware Software Support
Posts: 4810
52
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This question is not really about Stacks though You should be able to answer it even if you know nothing about the Stack class.
 
Darren Littlepage
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

This question is not really about Stacks though You should be able to answer it even if you know nothing about the Stack class.



I disagree.
I did not know what behavior push() has on a Stack object or if the object and method were just made up. I was not able to know if it is going to affect the reference passed in as an argument or not and how. I did not know what Stack.toString() method would return.

I just learned the hard way that Stack and push() exist and what they do.

It's good to know though.
 
Would you like to try a free sample? Today we are featuring tiny ads:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic