|
| |
Common Programming Errors
- Defining more than one public class in the same file is a syntax
error.
- Attempting to declare a return type for a constructor and/or attempting to
return a value from a constructor is a logic error. Java allows other
methods of the class to have the same name as the class and to specify
return types. Such methods are not constructors and will not be called when
an object of the class is instantiated.
- An attempt by a method which is not a member of a particular class to
access a private member of that class is a syntax error.
- Attempting to overload a method of a class with another method that has
the exact same signature (name and parameters) is a syntax error.
Source: Deitel, H.M. and Deitel P.J. Java: How to Program. 3rd ed. Upper Saddle River, New
Jersey. Prentice Hall.1999.
ISBN 0-13-012507-5, p 376-7.
|