Professional Documents
Culture Documents
What's a variable?
A Java variable is a piece of memory that can contain a data value
What's an array?
An array is a container object that holds a fixed number of values of a single type.
What's a class?
A class is the blueprint from which individual objects are created.
What's an interface?
In general, an interface is a device or a system that unrelated entities use to
interact. Within the Java programming language, an interface is a type, just as a
class is a type.
What's a void method?
The void keyword allows us to create methods which do not return a value.
What's polymorphism?
the ability of a message to be displayed in more than one form.
What's inheritance?
It is the mechanism in java by which one class is allowed to inherit the
features(fields and methods) of another class.
What's encapsulation?
Encapsulation is defined as the wrapping up of data under a single unit. It is the
mechanism that binds together code and the data it manipulates.
What's abstraction?
Data Abstraction is the property by virtue of which only the essential details are
displayed to the user. The trivial or the non-essentials units are not displayed to
the user
Overriding in Java
Overriding is a feature that allows a subclass or child class to provide a specific
implementation of a method that is already provided by one of its super-classes
or parent classes
Overloading in Java
Allows different methods to have the same name, but different signatures where
the signature can differ by the number of input parameters or type of input
parameters or both.
Difference between an array and arraylist
Type-Safety We cannot use generics along with array ArrayList allows us to store
because it is not a convertible type of only generic/ type, that's why it is type-
array. safe.
Length Array provides a length variable which ArrayList provides the size() method to
denotes the length of an array. determine the size of ArrayList.
Adding Elements We can add elements in an array by Java provides the add() method to add
using the assignment operator. elements in the ArrayList.
Loop statements
o do while loop
o while loop
o for loop
o for-each loop
Jump statements
o break statement
o continue statement
What's a constructor?
A constructor is a special method of a class or structure in object-oriented programming
that initializes a newly created object of that type. Whenever an object is created, the
constructor is called automatically
Types of exceptions
Built-in Exceptions User-Defined exceptions
ArithmeticException
ArrayIndexOutOfBoundsException
ClassnotfoundExceptions
What's a hashmap?
Is a part of Java’s collection. It provides the basic implementation of the Map
interface of Java. It stores the data in (Key, Value) pairs, and you can access
them by an index of another type
How are getters and setters used for?
Retrieving and updating the value of a variable outside the encapsulating class
Enum
An enum type is a special data type that enables for a variable to be a set of
predefined constants
What's an access modifier?
1. Private: The access level of a private modifier is only within the class. It
cannot be accessed from outside the class.
2. Default: The access level of a default modifier is only within the package. It
cannot be accessed from outside the package. If you do not specify any
access level, it will be the default.
3. Protected: The access level of a protected modifier is within the package
and outside the package through child class. If you do not make the child
class, it cannot be accessed from outside the package.
4. Public: The access level of a public modifier is everywhere. It can be
accessed from within the class, outside the class, within the package and
outside the package.
What's a thread?
Is the path followed when executing a program.