Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

- Please solve for b, c, d Q)Answer the following questions regarding Object cla

ID: 3574135 • Letter: #

Question

- Please solve for b, c, d

Q)Answer the following questions regarding Object class

public class TestObject {

public static void main(String [] args) {

Object x = new Object();

System.out.println(x.getClass());

System.out.println(x.getClass().getName());

}

}

(a) Execute the above program and submit the output.

Answer:

class java.lang.Object

java.lang.Object

(b)Explain the type of x

Answer: ???

(c) Explain the type of x.getClass()

Answer: ???

(d) Explain the type of x.getClass().getName()

Answer: ???

Explanation / Answer

The above mentioned program is the illustration to determne the Object class functionalities.Object class is the super class for all java classes.By default any class which is defined in java is the sub class /child class of Objact class.and all th properties of Object classs are inherited by the child class.

Here we created a class called TestObject.you can see we never used the keyword extends since we are able to use the methods of Object class in TestObject.

b)X is the type of Object class.but we can us it as object of TestObject class also.

c)x.getClass() provides the class name to which it s belongs to.and gives more information about the class.

d)x.getClass().getName() gives the information about the class includes the package name which the class is belongs to.