QUESTIONS AND CORRECT ANSWERS (COMPLETE VERIFIED SOLUTIONS)
GUARANTEED SUCCESS |GRADED A+!! (100% ACCURATE) GET IT RIGHT!!
What is the syntax to call an instance variable from the parent
class, in the child
class?-ANSWER-Do
"super.nameOfVariable"
Which type of casting is legal? - ANSWER-Upcasting is legal
When you declare an abstract method, do you have to add a
body that specifies
what the method does? -
ANSWER-NO
Can you instantiate an interface? - ANSWER-NO
Why doesn't it make sense to use the this keyword to refer to a
static instance variable within the class that you are currently
in? - ANSWER-"this" keyword refers to an object, and a static
variable is NEVER an object
, When would a child class that extends an abstract parent class
also have to be
declared abstract? - ANSWER-When it doesn't implement all
of the abstract
methods of the abstract
parent class
Why do we use .equals to check if two Strings are equal while
we use == to check if two integers are equal? - ANSWER-The ==
references the memory allocation which works for type
primitive objects. While .equals() is used for non primitive data
types because it compares the actual value of those objects
instead of comparing the memory allocation
How would you call a java program from the terminal? -
ANSWER-javac
Filename.java
Define the "stack" - ANSWER-smaller block of memory that is
fast to access,
and is where small data such as integers and
booleans are stored