What is Object-Oriented Programming (OOP)?
Save For Revision
Save For Revision
Bookmark this item, mark it difficult, or place it in a revision set.
Log in to save bookmarks, difficult questions, and revision sets.
WithoutBook brings subject-wise interview questions, online practice tests, tutorials, and comparison guides into one responsive learning workspace.
Know the top Java OOPs interview questions and answers for freshers and experienced candidates to prepare for job interviews.
Know the top Java OOPs interview questions and answers for freshers and experienced candidates to prepare for job interviews.
Search a question to view the answer.
Bookmark this item, mark it difficult, or place it in a revision set.
Log in to save bookmarks, difficult questions, and revision sets.
Example:
class BankAccount {
private double balance;
// other methods and fields
}
Bookmark this item, mark it difficult, or place it in a revision set.
Log in to save bookmarks, difficult questions, and revision sets.
Bookmark this item, mark it difficult, or place it in a revision set.
Log in to save bookmarks, difficult questions, and revision sets.
Example:
class Animal {
/* properties and methods */
}
class Dog extends Animal { /* additional methods and properties */ }
Bookmark this item, mark it difficult, or place it in a revision set.
Log in to save bookmarks, difficult questions, and revision sets.
Example:
void drawShape(Shape s) {
/* method implementation */
}
Bookmark this item, mark it difficult, or place it in a revision set.
Log in to save bookmarks, difficult questions, and revision sets.
Example:
super.display();
Bookmark this item, mark it difficult, or place it in a revision set.
Log in to save bookmarks, difficult questions, and revision sets.
Example:
final int MAX_VALUE = 100;
Bookmark this item, mark it difficult, or place it in a revision set.
Log in to save bookmarks, difficult questions, and revision sets.
Example:
abstract class Shape { /* abstract methods */ }
Bookmark this item, mark it difficult, or place it in a revision set.
Log in to save bookmarks, difficult questions, and revision sets.
Bookmark this item, mark it difficult, or place it in a revision set.
Log in to save bookmarks, difficult questions, and revision sets.
Example:
public void setName(String name) { this.name = name; }
Bookmark this item, mark it difficult, or place it in a revision set.
Log in to save bookmarks, difficult questions, and revision sets.
Example:
static int count = 0;
static void increment() { count++; }
Bookmark this item, mark it difficult, or place it in a revision set.
Log in to save bookmarks, difficult questions, and revision sets.
Example:
class Car {
Engine engine;
// other properties and methods
}
Bookmark this item, mark it difficult, or place it in a revision set.
Log in to save bookmarks, difficult questions, and revision sets.
Example:
interface Printable { void print(); }
Bookmark this item, mark it difficult, or place it in a revision set.
Log in to save bookmarks, difficult questions, and revision sets.
Example:
class Parent {
final void display() { /* method implementation */ }
}
Bookmark this item, mark it difficult, or place it in a revision set.
Log in to save bookmarks, difficult questions, and revision sets.
Example:
int add(int a, int b) {
/* method implementation */
}
double add(double a, double b) { /* method implementation */ }
Bookmark this item, mark it difficult, or place it in a revision set.
Log in to save bookmarks, difficult questions, and revision sets.
Example:
if (obj instanceof MyClass) { /* do something */ }
Bookmark this item, mark it difficult, or place it in a revision set.
Log in to save bookmarks, difficult questions, and revision sets.
Example:
class Animal { void makeSound() { /* method implementation */ } }
class Dog extends Animal { void makeSound() { /* overridden method implementation */ } }
Bookmark this item, mark it difficult, or place it in a revision set.
Log in to save bookmarks, difficult questions, and revision sets.
Example:
class Car { Car() { /* constructor code */ } }
Bookmark this item, mark it difficult, or place it in a revision set.
Log in to save bookmarks, difficult questions, and revision sets.
Example:
class SubClass extends SuperClass { SubClass() { super(); /* other constructor code */ } }
Bookmark this item, mark it difficult, or place it in a revision set.
Log in to save bookmarks, difficult questions, and revision sets.
Example:
class MyClass { MyClass(int x) { this(); /* other constructor code */ }
MyClass() { /* default constructor code */ } }
Bookmark this item, mark it difficult, or place it in a revision set.
Log in to save bookmarks, difficult questions, and revision sets.
Example:
class Singleton { private static Singleton instance = new Singleton();
private Singleton() {}
public static Singleton getInstance() { return instance; } }
Bookmark this item, mark it difficult, or place it in a revision set.
Log in to save bookmarks, difficult questions, and revision sets.
Example:
abstract class Shape { abstract void draw(); }
Bookmark this item, mark it difficult, or place it in a revision set.
Log in to save bookmarks, difficult questions, and revision sets.
Example:
void myMethod() throws IOException { /* method code */ }
Bookmark this item, mark it difficult, or place it in a revision set.
Log in to save bookmarks, difficult questions, and revision sets.
Example:
try { /* code that might throw an exception */ }
catch (Exception e) { /* handle the exception */ }
finally { /* code that always executes */ }
Bookmark this item, mark it difficult, or place it in a revision set.
Log in to save bookmarks, difficult questions, and revision sets.
Example:
StringBuilder sb = new StringBuilder().append("Hello").append(",").append(" World");
Bookmark this item, mark it difficult, or place it in a revision set.
Log in to save bookmarks, difficult questions, and revision sets.
Example:
class MyClass { /* methods and fields */ }
// implicitly extends Object class
Bookmark this item, mark it difficult, or place it in a revision set.
Log in to save bookmarks, difficult questions, and revision sets.
Example:
class MyClass implements Cloneable { /* methods and fields */
public Object clone() throws CloneNotSupportedException { return super.clone(); } }
Bookmark this item, mark it difficult, or place it in a revision set.
Log in to save bookmarks, difficult questions, and revision sets.
Example:
enum Days { SUNDAY, MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY }
Bookmark this item, mark it difficult, or place it in a revision set.
Log in to save bookmarks, difficult questions, and revision sets.
Bookmark this item, mark it difficult, or place it in a revision set.
Log in to save bookmarks, difficult questions, and revision sets.
Example:
class Parent { static void display() { /* method implementation */ } }
class Child extends Parent { static void display() { /* hiding method implementation */ } }
Bookmark this item, mark it difficult, or place it in a revision set.
Log in to save bookmarks, difficult questions, and revision sets.