Question: I NEED THE ANSWER IN JAVA . THANK YOU Answer Following Questions: 1. In a class, fields belong to the whole class, fields belong to

I NEED THE ANSWER IN JAVA .
THANK YOU
Answer Following Questions: 1. In a class, fields belong to the whole class, fields belong to each individual object. 2. If you don't override the toString method, what will be printed when you pass an object reference to System.out.println()? 3. Can we use == to compare two objects' contents? Explain why. If not, how do we compare two objects' contents? 4. Write the code to declare an enumerate type Pet, which only accept following values: Dog, Cat, Turtle, Reptile. 5. When will an object be deemed as garbage in java virtual machine and what will happen to it
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
