Quantcast
Channel: in Java syntax, Class
Browsing all 6 articles
Browse latest View live

Answer by Daniel Moses for in Java syntax, Class

There are a few confusing answers here so I will try and clear this up.You define a generic as such:public class Foo<T> { private T t; public void setValue(T t) { this.t = t; } public T...

View Article



Answer by Mac for in Java syntax, Class

You're correct.In Java generics, the ? operator means "any class". The extends keyword may be used to qualify that to "any class which extends/implements Something (or isSomething).Thus you have "the...

View Article

Answer by Krizz for in Java syntax, Class

You are almost right. Basically, Java has no concept of templates (C++ has).This is called generics.And this defines a generic class Class<> with the generics' attribute being any subclass of...

View Article

Answer by Thomas Ahle for in Java syntax, Class

You're correct.However usually you will want to name the class that extends Something and write e.g. <E extends Something>. If you use ? you can't do anything with the given type later.

View Article

Answer by Jan Vorcak for in Java syntax, Class

You're rightDefinition is that the class has to be subtype of SomethingIt's the same as Class<T>, but there is a condition that T must extends SomethingOr implements Something as Anthony Accioly...

View Article


in Java syntax, Class

Class<? extends Something>Here's my interpretation, it's class template but the class ? means the name of the class is undetermined and it extends the Something class.if there's something wrong...

View Article
Browsing all 6 articles
Browse latest View live




Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>
<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596344.js" async> </script>