In: Computer Science
1. From the constructor, you infer that the name of the class containing the constructor must be_______ .
2. Fill in the blanks so that the statement will instantiate a JButton object and assigns it to variable of JButton type:
JButton btn= _______ ("OK");
3. Fill in the blanks to complete the description of the constructor in the corresponding UML class diagram:
+<>______( _____ : ______)
1. From the constructor, you infer that the name of the class containing the constructor must be_______ .
Ans: JButton
Explanation: Class name and Method name will be same in case of constructor's
________________________________________________________________________________________________________________
2. Fill in the blanks so that the statement will instantiate a
JButton object and assigns it to variable of JButton type:
JButton btn= _______ ("OK");
Ans: JButton btn= new JButton("OK");
Explanation: Instantiate the class JButton by passing string "OK" that will create a button with label "OK"
________________________________________________________________________________________________________________
3. Fill in the blanks to complete the description of the
constructor in the corresponding UML class diagram:
+<
Ans: +<
Explanation: Method name is prefixed with
<