If Triangle is defined as an object, which of the following statements declare, create and assign an object reference to the variable myTriangle?
A) Triangle myTriangle;
B) myTriangle = new Triangle( );
C) Triangle myTriangle = new Triangle( );
D) New Triangle( ):
A) Triangle myTriangle;
B) myTriangle = new Triangle( );
C) Triangle myTriangle = new Triangle( );
D) New Triangle( ):
C) Triangle myTriangle = new Triangle( );
Which of the following statements is not true about a constructor of an object?
a. There can be multiple constructors in a class
b. If there is no constructor defined in a class, the system will generate a default constructor.
c. There can be one and only one constructor in a class
d. All of the above statements are true.
a. There can be multiple constructors in a class
b. If there is no constructor defined in a class, the system will generate a default constructor.
c. There can be one and only one constructor in a class
d. All of the above statements are true.
c. There can be one and only one constructor in a class
Flashcard set info:
Author: somgaet
Main topic: Informatik
Topic: Java
Published: 26.04.2010
Card tags:
All cards (17)
no tags