Revature 2 Flashcards
What is the difference between a queue and a stack?
A stack is an ordered list of elements where all insertions and deletions are made at the same end, whereas a queue is exactly the opposite of a stack which is open at both the ends meaning one end is used to insert data while the other to remove data.
Stack is known as LIFO and queue is known as FIFO rule .
What is the difference between a set and a map?
Both interfaces are used to store the collection of objects as a single unit. The main difference between Set and Map is that Set contains only data elements, and the Map contains the data in the key-value pair, so Map contains key and its value.
What is the difference between an abstract class and an interface?
An abstract class allows you to create functionality that subclasses can implement or override.
An interface only allows you to define functionality, not implement it
What is a constructor and how is it called?
In Java, a constructor is a block of codes similar to the method. It is called when an instance of the object is created, and memory is allocated for the object.
It is a special type of method which is used to initialize the object.
What does WHERE do in SQL?
The SQL WHERE clause is used to specify a condition while fetching the data from a single table or by joining with multiple tables. The WHERE clause is used to filter records. It is used to extract only those records that fulfill a specified condition.
What is the difference between method overload and method overriding?
Overloading occurs when two or more methods in one class have the same method name but different parameters.
Overriding means having two methods with the same method name and parameters
What is a class (Java)?
A class, in the context of Java, are templates that are used to create objects, and to define object data types and methods. Core properties include the data types and methods that may be used by the object
A class can also be defined as a blueprint from which you can create an individual object. Class doesn’t consume any space.