Can You please help me with this JAVA question? Question 1 (1 point) Which of th
ID: 3875266 • Letter: C
Question
Can You please help me with this JAVA question? Question 1 (1 point) Which of the following statements about objects is true? O An object is an instance of a class. O Each object created has its own set of member variables in memory. All objects are dynamically created in Java. An object is typically created as follows: ClassName refVarible new ClassName( paramsIfNeeded) O All of these statements are true. Save Question 2 (1 point) When you create an object a constructor is executed. Which of the methods below could be a constructor for Product objects? Assume that the Product class has a name data field. public void Product (String name)f O this.name name; public Constructor(String name)( O this.name name; public Product(String name) this.name..name; public makeProduct(String name) this.name-name;Explanation / Answer
Question1:
Option 4 : All of the statements are True.
Explanation:
When object created it means memory is allocated to it. If you create an object to a class. It means that you are allocating memory for variables(data members) that are declared in the class. Each object contains individual memory allocation based on the type of variables declared in the corresponding class.
All objects are dynamically created in java. It means at run time memory will be allocated and wastage of the memory will be eliminated by grabage collector by default. memory will be allocated at run time after exection memory will be released.
Question 2:
Option 3:
public Product(String name)
{
this.name = name;
}
Explanation:
Constructor does not contain any return type option1 contain return type void.
Constructor name is same as class name. So option 4 is not valid.
We cannot use constructor key word for constructor So option 2 is invalid.
We can use access specifier like public/private/protected for constructor. So option 3 is valid
and its(Constructor) name is also as Class name(Product)
Question 10:
False
Explanation:
We cannot create object to a Abstract Class. Abstract class contain at least one abstract method with normal methods. Abstract method is a method without any body implementation.
So it cannot be instantiated.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.