Home
Flashcards
Preview
JAVA INTERVIEW QUESTIONS
Home
Get App
Take Quiz
Create
(OOP)
What is a class?
In OOP terms, a class is a template for creating multiple objects. It defines the state and behavior of the object.
(OOP)
What is an Object?
An instance of a class
CricketScorer cricketScorer = new CricketScorer();
cricketScorer
is an
object
of the class
CrickeScorer
.
(OOP)
What is state of an object?
The state of object is the
values
that it has at that particular point in
time
.
(OOP -Java)
What is the
super class
of every class in Java
.
Object
.
When we create an object it inherits all the
methods
and
properties
of the Object class.
(OOP)
What is the
behavior
of an object?
Methods
supported by an object.
(Java Object class)
Explain the toString() method.
Prints the
contents
of
a given
object
.
(Java Object class)
Explain the
equals()
method.
used when we want to
compare
two objects.
(Java Object class)
Show
how to implement
a derived class of toString() in a class.
@Override
public
String toString
(){
return
"Animal [name="
+
name
+
", type="
+
type
+
"]"
;
}
(OOP)
Show a simple example of using the
extends
key word to create a class Hero which inherits from a base class Actor.
public class
Hero
extends
Actor {
public
void
fight
(){
System.
out
.println(
"fight"
);
};
}
(General Knowledge)
Create a
main
class in java
public static
void
main
(String[] args) {
//Printout a greeting
.
System.
out
.println(
"Hello World!"
);
}
Author
geschw66
ID
355445
Card Set
JAVA INTERVIEW QUESTIONS
Description
Possible Java interview questions thwarted on the unsuspecting chump job applicant.
Updated
2021-06-10T16:43:07Z
Show Answers
Home
Flashcards
Preview