Q&A

Q1:Can constructor methods send back a value like other methods?
A1: No, because there's no way to receive that value. Unlike other methods that can be used as part of an equation, the argument of a method, or other statements, constructors are only handled in response to a new statement. There's no way for that statement to receive a value that would be sent by the method.
Q2:Do you have to create an object to use class variables or methods?
A2: Because class variables and methods aren't associated with a specific object, you don't need to create an object solely for the purpose of using them. The use of the Integer.parseInt() method is an example of this because you don't have to create a new Integer object just to convert a string to an ...

Get SAMS Teach Yourself Programming with Java™ in 24 Hours, FOURTH EDITION now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.