In: Computer Science
A UML class diagram has the following description about a member of the class:
+ getHeaderField(name:String):String
Which of the following is a correct declaration of the member in Java?
1 public String getHeaderField(String name) |
||
2 public String getHeaderField; |
||
3 public String getHeaderField(String) |
||
4 public static String getHeaderField( name) ------------------------------------------------------------------------------------------------------------------------------------- Note: all answers are case sensitive. Inside a class, the declaration of a constructor looks like the following: public JButton(String text) 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: +<<constructor>>_____________ (________________: _______________) |
Question 1:
+ getHeaderField(name:String):String
Which of the following is a correct declaration of the member in Java?
Answer:
1 public String getHeaderField(String name)
Question 2:
Answer:
Inside a class, the declaration of a constructor looks like the following:
public JButton(String text)
1. From the constructor, you infer that the name of the class containing the constructor must be ___Parameterized Constructor____________ .
2. Fill in the blanks so that the statement will instantiate a JButton object and assigns it to variable of JButton type:
JButton btn= new JButton("OK");
3. Fill in the blanks to complete the description of the constructor in the corresponding UML class diagram:
Answer:
+ JButton(text:String)