TICS Coding Standard Viewer 
TIOBE Software Quality Framework
Print-friendly version
©TIOBE Software www.tiobe.com
 
TIOBE - Java Coding Standard
Search

Rule:  Design19Checked automatically with code checker

Synopsis:Avoid instantiating an object just to call getClass() on it; use the .class public member instead
Language:Java
Severity Level:4
Category:Design


Description:
Avoid instantiating an object just to call getClass() on it; use the .class public member instead.
public class Foo {
 // Replace this
 Class c = new String().getClass();
 // with this:
 Class c = String.class;
}