A good answer might be:The completed program is given below. | |
Using a Constructor in a DeclarationHere is the complete program, with the blanks filled in as suggested.
There is an even shorter way to do this, but it works only for String objects:
The new operation still happens behind the scenes;
this way is just "shorthand" for the longer way.
For other classes you need to use the new Constructor() way
of creating an object.
| |
QUESTION 17:Which of the following are correct? Click Here after you have answered the questionString ant = "It was a dark and stormy night." String bat = new( "A shot rang out in the dark." ); int cat = "123"; double dog = 45.69; |