#Stack class questions

12 messages · Page 1 of 1 (latest)

flat patio
#

What happens if I don't use the "<>" when calling the constructor. Example: Stack myStack = new Stack();

Do I need to set the Class inside of the "<>" when calling the constructor in the "new Stack<>();"?, and why. Example Stack <Integer> myStack = new Stack();.

Thank you!3

pearl belfryBOT
#

This post has been reserved for your question.

Hey @flat patio! Please use /close or the Close Post button above when you're finished. Please remember to follow the help guidelines. This post will be automatically closed after 300 minutes of inactivity.

TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.

spring yoke
#

that creates a raw type and basically makes the generics useless

flat patio
#

What is a raw type?

spring yoke
#

when using generics where the generic can be inferred from context, like in your example, <> lets java infer the generic

#

sec

#
#

The warning shows that raw types bypass generic type checks, deferring the catch of unsafe code to runtime. Therefore, you should avoid using raw types.

flat patio
#

Let me process it xd

#

thank you

pearl belfryBOT
# flat patio thank you

If you are finished with your post, please close it.
If you are not, please ignore this message.
Note that you will not be able to send further messages here after this post have been closed but you will be able to create new posts.