Jtest logo




Contents  Previous  Next  Index

PB.NAMING


The method name should not be same the class name unless it is a constructor

Description

This rule flags code where a non-constructor method has the same name as its class.

A non-constructor method should not have the same name as its class; if it does, it probably indicates a typo.

Example

 package PB;
 
 public class NAMING {
     public NAMING () {}   // constructor
     public void NAMING (int size) {}  // not a constructor, it's
	 probably a typo.
 }

Repair

Verify the name of the method and change it as you intended.

Reference

Daconta, M, Monk, E, Keller, J, and Bohnenberger, K. Java Pitfalls. John Wiley & Sons, 2000, pp.12 - 14.


Contents  Previous  Next  Index

ParaSoft logo
(888) 305-0041 info@parasoft.com Copyright © 1996-2001 ParaSoft