07 November 2020

#OOPS

OOPS
What is Single Inheritance?
What is Multilevel Inheritance?
What is Hierarchical Inheritance?
What is Hybrid Inheritance?
What is Multiple Inheritance?
What is string constant pool?
What is special about string objects as compared to objects of other derived types?
What is the difference between String, StringBuffer and StringBuilder?
What is string intern?
What is the main difference between Java strings and C, C++ strings?
What is the similarity and difference between String and StringBuffer class?
What is the similarity and difference between StringBuffer and StringBuilder class?
What is difference between Java 8 StringJoiner, String.join() and Collectors.joining()?
What is ArrayStoreException in java? When you will get this exception?
What is an anonymous array? Give example?
What is the difference between int[] a and int a[] ?
What is ArrayIndexOutOfBoundsException in java? When it occurs?
What are the types of inheritance.?
What are the differences between Array and ArrayList in java?
What are the different ways of copying an array into another array?
What are jagged arrays in java? Give example?
What are the different ways of declaring multidimensional arrays in java?
What are the different ways to iterate over an array in java?
What are the drawbacks of the arrays in java?
What do you mean by inheritance.?
What do you mean by mutable and immutable objects?
What do you think about string constant pool? Why they have provided this pool as we can store string objects in the heap memory itself?
What happens if both, super class and sub class, have a field with same name.?
What value does array elements get, if they are not initialized?
How to reverse a sentence word by word in Java?
How do you implement multiple inheritance in java?
How do you restrict a member of a class from inheriting to it’s sub classes.?
How do you create mutable string objects?
How do you convert given string to char array?
How do you count the number of occurrences of each character in a string?
How do you remove all white spaces from a string in Java?
How do you find duplicate characters in a string?
How do you convert string to integer and integer to string in Java?
How do you check the equality of two arrays in java? OR How do you compare the two arrays in java?
How do you sort the array elements?
How do you find the intersection of two arrays in java?
How do you search an array for a specific element?
How do you find duplicate elements in an array?
How do you find second largest element in an array of integers?
How do you find all pairs of elements in an array whose sum is equal to a given number?
How do you separate zeros from non-zeros in an integer array?
How do you find continuous sub array whose sum is equal to a given number?
Are constructors and initializers also inherited to sub classes.?
Are static members inherited to sub classes?
Can a class extend more than one classes or does java support multiple inheritance? If not, why?
Can a class extend itself.?
Can we call String class methods using string literals?
Can you pass the negative number as an array size?
Can you change the size of the array once you define it? OR Can you insert or delete the elements after creating an array?
Can you instantiate this class?
Do you have any idea why strings have been made immutable in Java?
How find maximum occurring character in a string in Java?
In how many ways you can create string objects in Java?
Is String a keyword in Java?
Is String a primitive type or derived type?
Print all substrings of a string in Java?
Print common characters between two strings in alphabetical order in Java?
Where exactly string constant pool is located in the memory?
Which class do you recommend among String, StringBuffer and StringBuilder classes if I want mutable and thread safe objects?
Which one will you prefer among “==” and equals() method to compare two string objects?
While creating the multidimensional arrays, can you specify an array dimension after an empty dimension?
Why StringBuffer and StringBuilder classes are introduced in Java when there already exist String class to represent the set of characters?
Write a Java program to reverse a string?
Write a Java program to check whether two strings are anagram or not?
Write a Java program to reverse a given string with preserving the position of spaces?
Write a code to prove that strings are immutable in Java?
Write a code to check whether one string is a rotation of another?
Write a Java program to reverse each word of a given string?
You know that all classes in java are inherited from java.lang.Object class. Are interfaces also inherited from Object class.?
What is Destructor?
What are manipulators?
What is a virtual function?
What is a ternary operator?
What is method overriding?
What is the main difference between overloading and overriding?
What is the difference between new and override?
What is Polymorphism?
What is Abstraction?
What is hierarchical inheritance?
What is Runtime Polymorphism (Dynamic Polymorphism)?
What is Compile time polymorphism (Static polymorphism)?
What is encapsulation?
What is the diamond problem?
What is Aggregation?
What is the difference between Association and Dependency?
What is Composition?
What Is Operator Overloading?
What Is The Use Of Finalize Method?
What Is Exception Handling?
What Is Pure Virtual Function?
What are the rules of method overloading and overriding in Java?
What is the covariant method overriding in Java?
What problem is solved by the Strategy pattern in Java?
What are the problems might be created when you are trying to implement multiple inheritance concept in java?
What are the pillars of OOP theory?
What is a parametric constructor?
What is a friend function?
What is early binding?
What is late binding?
What are tokens?
What is the need of abstract class?
What is the key difference between concrete class and abstract class?
What are the advantages of object oriented programming?
What are the properties that are defined in an Object model?
What is Coupling?
What is Is-A and Has-A relationship?
What is object cloning?
What is multiple inheritance?
What are access modifiers?
What is a class?
What is a constructor in java?
What is a superclass?
What is a token?
What is an Abstract class in OOP?
What is an object?
What is Association?
What is class and object?
What is data hiding?
What is early and late binding?
What is inheritance? Benefits? Types?
What is Oops? Features? Why do we need OOPs?
What is Static Binding?
What is subclass?
What is super () in Java?
What is the difference between class and structure?
What is the difference between classes and objects?
What is Autoboxing and Unboxing?
What is JVM, JDK and JRE?
What is the Java’s WORA nature?
What is Serialization? When should we make use of serialization?
What is Constructor and Constructor Overloading in Java.
What is Expressions?
What is class in Java.
What is JSON.
What is Loops? Types?
What is Interface in Java
What is Aggregation
What is Java Collections
What is Serialization
What is Use Cases in Java
What is Overloading and Overriding in Java?
What is a List?
What is the case when you override hashcode() and equals() ? What problem can occur if we don’t override hashcode() method?
What is immutable classes?
What is Singleton in Java?
What is the Final Keyword in Java?
What is Collection and a Collections Framework?
What do you mean by BlockingQueue in Java Collections Framework?
What is a platform?
What is classloader?
What is the static method?
What are the two ways of implementing multi-threading in Java?
What is constructor chaining in Java?
What kind of variables can a class consist of?
What is Singleton class?
What do you mean by Access Modifier?
What is an applet?
What is Comparable Interface?
What are the actions present in the JVM?
What is the current version of JDK?
What is Wrapper class?
What is String?
What is Function?
What is Class?
What is Object?
Why Java does not support multiple inheritance?
What is scope?Describe the types of scope?
What is Multitasking? How to achieve multitasking?
What is Thread?
what is Multithreading?
What is Serialization?
What is DeSerialization?
What is Java ?
What is Treeset?
What happens if you add same key in the hashmap?
What is default method in java 8 interface?
What is token in c
What is keywords, data type, constant and variable
What are the fundamental data type in c
What are the conditional statement
What are the un-conditional statement
What is if—else statement
What is switch case statements
What is conditional operator
What are the iterative statement
What is an array
What is sorting
What is searching
What is function
What is recursive function
What is structure
What is pre-processor directive
What is micro in c
What is file
What is file pointer
What is data structure
What is stack
What is queue
What is link list
What is binary tree
What is spanning tree
What is constructor and destructor in c++
What is static keyword
What is friend function
What is pure virtual function
What is copy contractor in c++
What is Java
What final in java
What is super keyword in java
What is an applet program
What is thread
What is synchronisation
What is JDBC
What are jdbc driver
What are steps involved in data base connectivity
What will be the result of relational operators?
What will happen if we use throws keyword in body?
What is the default priority of thread?
What is default priority of gc()?
What is Comparator?
What is workspace?
What are Access specifiers?
What is Multiple Mitigation?
What stand is for JDK, JRR and JVM?
What is the default size of the loaded factor in hacking on the basis of the collection?
What is a collection?
What is Exception Classes are the Basic Class?
What is a JVM?
What researchers are in Java?
What is a standard method?
What is the subject class?
What are the packages in Java?
What is the standard import?
What is the benefit of Volatile Variable
What is hashCode method? And why it is to be overridden?
What is the contract between equals and hashCode?
What is the need of toString() method?
What is the need of Reflection API?
What is the need of anonymous inner classes?
What is a JVM? What is the utilization of JVM?
What is the contrast between JDK, JRE and JVM?
What is Object Oriented worldview?
What is the EAR record?
What is a MVC Architecture?
what number kinds of constructors are utilized in Java?
What are the principle employments of the super catchphrase?
What is the distinction between the last strategy and theoretical technique?
What is the contrast among Collection and Collections in JAVA?
What is JSTL?
What are Exceptions in Java? Types?
What is JSF?
What are Action Forms?
What is JDBC?
What is a JDBC driver and what number of JDBC drivers are accessible?
What are the JDBC proclamations?
What are the exemptions in JDBC?
What the base class in Java from which all classes are derived?
What the purpose of using Break in each case of Switch Statement?
What is decision Making in Java
What is Thread in Java
What is wait () method
What is static block
What is the key word in exceptional handling?
What is the key word?
What is banned?
What is Java Bean?
What are the operations of collections?
What are the types of Polymorphism in Java?
What are the advantages of Polymorphism?
What is Binding in Java?
What are the types of binding in Java?
What is Static binding in Java?
What is Dynamic binding in Java?
What is the difference between static binding and dynamic binding in Java?
What is object-oriented programming?
What are the four important characteristics of object-oriented programming
What is procedural programming paradigm
What is JDK?
What is JRE?
What are the main components of JRE?
What is Class Loader?
What is Interpreter?
What is JVM?
What are the main activities (tasks) that are performed by JVM?
What is Java API? What is the popular Java API?
What is Bytecode verifier?
What is Java Library?
What is Bytecode in Java?
What is the difference between bytecode and machine code?
What is source code in Java?
What is the difference between source code and bytecode?
What is the role of Execution engine in JVM?
What is Java compiler? What are the functions (responsible tasks) for Java compiler?
What are the different types of memory areas allotted by JVM
What is JIT Compiler? And explain its need?
Name the Data Types that are supported by Java?
Name the different states of a thread.
Name the most important aspect of Java
Write a Program using Arraylist to add and remove some items from the list.
What is constructor?
What is hashtable?
What is multi-threading and the ways of implementing multi-threading in Java?
What is Java Heap Space?
What is user define function?
What is garbage collections?
What is “this” keyword
What is “Super” keyword?
What is final variable
What is HashSet
What is notify () and notify all ()
What is applet
What is Thread life-cycle
How HashMap internal working ?
How internallly hashset working?
Provide the features of Hashtable method
What are the keywords available in exception handling?
Provide the list of thread methods to stop a thread in Java
Provide byte datatype default value in Java
Why is Inheritance used in Java?
Why is OOP better than procedural?
Why is dynamic binding used in object-oriented programming?
How is Inheritance useful to achieve Polymorphism in Java?
Why Encapsulation in java is called as Data hiding in java?
Why is Java known as the Platform Independent Programming Language?
Why break is used in Switch Statement’s each case?
Why are Strings are called as Immutable?
Why Java is considered dynamic?
Why is StringBuffer called mutable?
Why Runnable Interface is used in Java?
Why IS Java application platform independent?
Why used super and this keyword in java?
Why we cannot be apply access specifiers to packages, initializers, local variables?
Why do we say Java is dynamic?
Why java is platform-independent language?
Why wait() method is in Object class and not in Thread class?
Why Map Hierarchy is kept separate form Collection Hierarchy?
Why static binding is also called early binding in Java?
Why Dynamic binding is also called late binding in java?
Why binding of private, static, and final methods are always static binding in Java?
Why is Java System Independent
Why is Java Portable?
Why compiled java code can execute on different computer machines?
Which class Cannot be a subclass in Java?
Which types of exceptions are caught at compile time?
Which thread will execute first?
Which data structure set uses?
Which name will be checked by the compiler for the execution of program?
Which name will be checked by the JVM after the compiling the program?
Which operators are used for masking the data in encryption and decryption process?
Which is maintained to manage the life cycle of local variables?
Which operator is not used in java?
Which exceptions are used to represent the business/environmental failure?
Which feature allows the JVM to run more than one thread in java?
Which methods are there in the thread class?
Which condition will result in Illegal state exception?
Which will manage the lifecycle of thread?
Which interface will result in sorted order?
Which will interact with hard disk?
Which of the following is not the Java object Class method?
How many instances can be created for an abstract class?
How Can We Call The Base Method Without Creating An Instance?
How do you differentiate between a class and an object?
How do structure and class differ?
How a program can be structured using the concept of Object oriented programming?
How many types of constructors are used in Java?
How can struct be instantiated?
How do you differentiate a HashSet class and a TreeSet class?
How can you define Object Cloning in Java?
How can we execute any code even before the main method?
How would you call wait() method? Would you use if block or loop, and why?
How do you take thread dump in Java?
How we can execute any code even before main method?
How can we make the copy of a Java object?
How to achieve lock?
How to get the current thread?
How to sort the collections?
How are they destroyed in Java?
How many times do you call the trash cushion for the last time () method for an object?
How can garbage collection be enforced?
How many ways the object can be created?
Difference - Composition vs Inheritance?
How Java compiler differentiate between methods in Compile time Polymorphism?
How to achieve/implement dynamic polymorphism in Java?
How Java compiler performs static binding?
How JVM performs dynamic binding in Java?
How does Bytecode work in Java?
When a byte datatype is used?
When parseInt() method can be used?
When throw keyword is used?
When a super keyword is used?
When null pointer exception occurs?
When Out of memory error occurs?
When Out of stack error occurs?
When we can use final class?
When was Java created?
Where all string literals are managed?
Difference - Procedural programming VS OOPS
Difference - Compile-time and runtime-polymorphism?
Difference - Primitive == vs overridden equals() method?
Difference - String vs StringBuffer vs StringBuilder?
Difference - Checked and Un-Checked Exceptions?
Difference - throw and throws keyword?
Difference - wait() and sleep() method?
Difference - Abstraction vs encapsulation
Difference - ArrayList and Vector
Difference - ArrayList and Vector?
Difference - Enumeration and Iterator?
Difference - JDK, JRE, and JVM?
Difference - Inner Class and a Sub-Class?
Difference - Sleep and Wait in Java?
Difference - final, finalize and finally?
Difference - poll() and remove() method?
Difference - StringBuilder and StrinngBuffer?
Difference - Abstract and Interface
Difference - while and do-while
Difference - Fixed and Dynamic load?
Difference - Array and Vector?
Difference - Stack and Queue?
Difference - Stack and the Queue?
Difference - importing java.util.Date and java.util? *?
Difference - Multithreading and Multiprocessing?
Difference - Array and Arraylist?
Difference - error and exception?
Difference between abstract and final method
Difference - ArrayList and a LinkedList?
Difference Java compiler and interpreter?
In a class which is the default access modifier in java?
In which scenarios Arraylist and LinkedList will be used?
In Heap memory which variables are created?
In java, how arrays are created?
In Java is it pass by value or pass by reference?
Will all the Try blocks in Java end with Catch Blocks?
Will you be able to overload the main() method?
Do you know whether constructor returns any value in Java?
Abstract class cannot be instantiated. Why?
Abstract method cannot have body, why?
Are you connecting to a database in Java?
Difference - NoClassDefFoundError vs ClassNotFoundException?
At time of method overriding can return type be different?
Can we make a class both final and abstract at the same time?
Can you explain what Access Modifiers are?
Can we change the scope of the overridden method in the subclass?
Can we override a method declared as private in java?
Can you override the method which is declared as final?
Can a constructor be declared as private in java?
Can a class extend two interfaces wherein they both have a method with the same name and signature in java?
Can struct have Parameterless constructor?
Can constructor be static?
Can a struct be null?
Can struct have inheritance?
Can struct inherit?
Can we override static method?
Can you call the base class method without creating an instance?
Can you explain what Access Modifiers are?
Can a class have multiple constructors?
Can we have two methods in a class with the same name?
Can we use a default constructor of a class even if an explicit constructor is defined?
Can we override a method by using same method name and arguments but different return types?
Can we add null key to the hashmap?
Can we have filename and classname as same?
Are the exceptions defined in JavaScript packages? Or are there any definitions for all classes?
Can we have two start() methods in thread execution?
Can a Dead End Start Again?
Can the standard block be lifted?
Can we try or do not try to stop it?
Can finally ban without c block?
Can exceptions occur in catch block?
Can you give an example of pointers?
Can static methods be overridden?
Conside the following block and predict the output
Consider the following code.
Differences - Polymorphism and Inheritance
Does java 8 supports functional programming?
Does java support pointers?
From which method the execution of java programs begins?
Functions of JVM and JRE?
Garbage collection in Java?
Give an example of static binding.
Give an example of dynamic binding in Java.
Give few examples of object-oriented language other than Java
Hashmap put() operations uses which datastrcture when the hashcode is same ?
If we don’t initialize Boolean variable and print that Boolean value, false will be the output
Is Java a pure object-oriented language? if not why?
Is a method declared as final inherited in java?
Is it possible to declare a class as Abstract without using any abstract method?
Is it true that a java program never goes out of memory because of garbage collection feature?
Is throw and throws keyword can be used interchangeably? If no, what is the difference between the two?
Is String a data type in java?
Is ++ operator thread-safe in Java?
Is wrapper classes overrides hashcode and equals method.
Is there a number of capture blocks after an endorsement line?
Is it possible to make a constructor final?
Is it possible to overload the constructors?
Is it possible to use both “this()” and “super()” in a constructor?
Is possible for you to declare a constructor as final?
Is it possible to implement runtime polymorphism by data members in Java?
Java is fully OOPS language or not?
List out the 5 access modifiers
List any five features of Java?
List the three steps for creating an Object for a class?
List out the different access specifiers available for Java classes
List out the constructors in Java
List out the advantages of Java packages
List out the vital advantages of the keyword “Super”
List out the interfaces available in Java collections
List out the Classes available in Java collections
List out the maps available in Java collections
Mention the access specifiers used in Java?
Mention the class which is the superclass for the entire classes
Can you handle a catch in an exception to an exception?
Sort of ancient data types?
The object which has no reference is called?
The use of Java’s last words?
Throw some light on the main features of Java.
Throwing in Java
To set a permit for the thread that wants access to the shared resource is called,
Two differences in the state between a class and one square
Types of Access Specifiers?
Topic Content
Object
  • Object class methods
    • String toString()
    • int hashCode()
    • protected void finalize()
    • boolean equals(Object obj)
  • Difference between Entity and Object
Class & Constractor
  • Class : A class is a group of objects which have common properties
  • Modifiers : public, private, protected, default.
  • Fields : Member variables in a class.
  • Local variables : Variables in a method or block of code—these.
  • Parameters : Variables in method declarations.
Constractor
  • Constructor name must be the same as its class name.
  • It must have no explicit return type.
  • It cannot be abstract, static, final, and synchronized.
  • Type
    • Default constructor (no-arg constructor) - The default constructor is used to provide the default values to the object like 0, null, etc., depending on the type.
    • Parameterized constructor - A constructor which has a specific number of parameters is called a parameterized constructor.
  • Java Copy Constructor
      • By constructor
      • By assigning the values of one object into another
      • By clone() method of Object class
Static
  • Static Variable
  • Static Block
    • It is used to initialize the static data member.
    • It is executed before the main method at the time of classloading.
  • Static Method
    • A static method belongs to the class rather than the object of a class.
    • A static method can be invoked without the need for creating an instance of a class.
    • A static method can access static data member and can change the value of it.
  • Static Class
Inheritance
  • Inheritance
    • Constructor cannot be inherited in Java.
    • Private members do not get inherited in Java.
    • Cyclic inheritance is not permitted in Java.
    • Assign parent reference to child objects.
    • Constructors get executed because of super() present in the constructor.
  • Inheritance
    • Single Inheritance
    • Multi-level Inheritance
    • Hierarchical Inheritance
    • Hybrid Inheritance
Final
  • Final variable
    • If you make any variable as final, you cannot change the value of final variable(It will be constant).
    • It can be initialized only in constructor.
    • If you want to create a variable that is initialized at the time of creating object and once initialized may not be changed, it is useful. For example PAN CARD number of an employee.
  • Final method
    • If you make any method as final, you cannot override it.
    • Final method is inherited but you cannot override it.
  • Final class
    • If you make any class as final, you cannot extend it.
Polymorphism
Method Overloading Method Overriding
Method overloading is performed within class. Method overriding occurs in two class.
In case of method overloading, parameter must be different. In case of method overriding, parameter must be same.
It is the example of compile time polymorphism. It is the example of run time polymorphism.
In java, method overloading can't be performed by changing return type of the method only.  Return type must be same or covariant in method overriding.
Return type can be same or different In method overloading. But you must have to change the parameter.
private and final methods can be overloaded It cannot be overridden.
Abstraction & Interface
Abstract-class Interface
To avoid independence For future enhancement
Can have abstract and non-abstract methods Only abstract methods. Java 8 onwards it can have default and static methods also
Can have constructor Not possible
Member of interface can be static Not possible
Doesn't support multiple inheritance Supports multiple inheritance
Can have final, non-final, static and non-static variables Only static and final variables
Can provide the implementation of interface It is not possible to provide the implementation of abstract class
Can extend another Java class and implement multiple Java interfaces Not possible
Fast Slow
Garbage Collections

No comments:

Post a Comment

Most views on this month