Tuesday, October 25, 2011

5 questions about Java

1)What is erasure?

It refers to the fact that information of parameter type instantiation of generic Java classes does not exist at run time, but only at compile time.

2) What three properties should be satisfied by objects with respect to the .equals() method?

Reflexivity, symmetry, and transitivity.

3) How does test-driven development affect interface and API design?

Since the tests are written before their respective testee modules, the module interface and API are first formulated in writing the tests for those modules. Therefore, the interfaces and API"s are designed for usability and testability from the outset, and take into account the perspective from the outside of the class, as opposed to just the internal implementation oriented perspective.

4)Does inheritance hold with respect to the parameterized type in instantiations of generic classes in Java?

No, it only holds with respect to the container type. So, for example, List<Object> is not a superclass of List<String>, but Collection<String> is a superclass of List<String>, with the consequent implications for assignability.

5)What are the three levels of granularity for which we can disable PMD error testing?

Annotation level(classes or methods annotated with @SuppressWarnings), and line level (lines followed by //NOPMD).
For more info see: http://pmd.sourceforge.net/suppressing.html

No comments:

Post a Comment