Answer:
String ant = "It was a dark and stormy night." Correct. String bat = new( "A shot rang out in the dark." ); Wrong--new needs a constructor name. int cat = "123"; Wrong--can't initialize an int to a String double dog = 45.69; Correct
End of the Chapter
You may wish to review the following. Click on a subject that interests you to go to where it was discussed.
- Three characteristics of objects.
- What software objects are made out of.
- Members of an object.
- von Neumann computers.
- What a class is.
- Cookie cutters and cookies
- The static modifier.
- static methods
- How the Java virtual machine starts a program up.
- Constructors
- Parameter
- Dot notation.
- Using a constructor in a variable declaration.
The next chapter will discuss object references.