[LATEST] JAVA Interview Question & Answer | Beginner & Advanced
job opening acte

[LATEST] JAVA Interview Question & Answer | Beginner & Advanced

Last updated on 02nd Aug 2020, Blog, General

About author

Ramesh (Sr Project Manager )

Highly Expertise in Respective Industry Domain with 7+ Years of Experience Also, He is a Technical Blog Writer for Past 4 Years to Renders A Kind Of Informative Knowledge for JOB Seeker

(5.0) | 15212 Ratings 1237

1) What are the life-cycle methods for a jsp?


public void jspInit()It is invoked only once, same as init method of servlet.
public void _jspService(ServletRequest request,ServletResponse)throws ServletException,IOExceptionIt is invoked at each request, same as service() method of servlet.
public void jspDestroy()It is invoked only once, same as destroy() method of servlet.

2) What are the JSP implicit objects?


JSP provides 9 implicit objects by default. They are as follows:

1) out JspWriter
2) request HttpServletRequest
3) response HttpServletResponse
4) config ServletConfig
5) session HttpSession
6) application ServletContext
7) pageContext PageContext
8) page Object
9) exception Throwable

3) What are the differences between include directive and include action?


include directiveinclude action
The include directive includes the content at page translation time.The include action includes the content at request time.
The include directive includes the original content of the page so page size increases at runtime.The include action doesn’t include the original content rather invokes the include() method of Vendor provided class.
It’s better for static pages. It’s better for dynamic pages.

4) How to disable caching on back button of the browser?


  • <%
  • response.setHeader(“Cache-Control”,”no-store”);
  • response.setHeader(“Pragma”,”no-cache”);
  • response.setHeader (“Expires”, “0”);                    //prevents caching at the proxy server
  • %>   

5) What are the different tags provided in JSTL?


There are 5 type of JSTL tags.

  • core tags
  • sql tags
  • xml tags
  • internationalization tags
  • functions tags

6) How to disable session in JSP?


<%@acteadmin page session=“false” %>   

7)  How to delete a Cookie in a JSP?


The following code explains how to delete a Cookie in a JSP :

  • Cookie mycook = new Cookie(“name1″,”value1”); 
  • response.addCookie(mycook1);
  •  Cookie killmycook = new Cookie(“mycook1″,”value1”); 
  • killmycook . set MaxAge ( 0 ); killmycook . set Path (“/”); killmycook . addCookie ( killmycook 1 );

8) Explain the jspDestroy() method.


jspDestry() method is invoked from javax.servlet.jsp.JspPage interface whenever a JSP page is about to be destroyed. Servlets destroy methods can be easily overridden to perform cleanup, like when closing a database connection.

9) How is JSP better than Servlet technology?


JSP is a technology on the server’s side to make content generation simple. They are document-centric, whereas servlets are programs. A Java server page can contain fragments of Java program, which execute and instantiate Java classes. However, they occur inside an HTML template file. It provides the framework for the development of a Web Application.

10) Why should we not configure JSP standard tags in web.xml?


We don’t need to configure JSP standard tags in web.xml because when container loads the web application and find TLD files, it automatically configures them to be used directly in the application JSP pages. We just need to include it in the JSP page using taglib directive.

11) How will you use JSP EL in order to get the HTTP method name?


Using pageContext JSP EL implicit object you can get the request object reference and make use of the dot operator to retrieve the HTTP method name in the JSP page. The JSP EL code for this purpose will look like ${pageContext.request.method}.

12) What is Polymorphism?


Polymorphism means many forms.

A single object can refer to the super-class or sub-class depending on the reference type which is called polymorphism.


  • Public class Manipulation(){
  • //Super classpublic void add(){}
  • }
  • public class Addition extends Manipulation(){
  • // Sub classpublic void add(){}
  • public static void main(String args[]){
  • Manipulation addition = new Addition();
  • //Manipulation is reference type and Addition is reference typeaddition.add();
  • }}

Using Manipulation reference type we can call the Addition class “add()” method. This ability is known as Polymorphism. Polymorphism is applicable for overriding and not for overloading.

13) What is meant by Method Overriding?


Method overriding happens if the sub-class method satisfies the below conditions with the Super-class method:

  • Method name should be the same
  • The argument should be the same
  • Return type also should be the same

The key benefit of overriding is that the Sub-class can provide some specific information about that sub-class type than the super-class.


  • public class Manipulation{
  • //Super classpublic
  • void add(){………………}} 
  • Public class Addition extends Manipulation(){
  • Public void add(){………..}
  • Public static void main(String args[]){
  • Manipulation addition = new Addition();
  • //Polimorphism is appliedaddition.add();
  • // It calls the Sub class add() method}}

addition.add() method calls the add() method in the Sub-class and not the parent class. So it overrides the Super-class method and is known as Method Overriding.

14) What is meant by Overloading?


Method overloading happens for different classes or within the same class.

For method overloading, sub-class method should satisfy the below conditions with the Super-class method (or) methods in the same class itself:

  • Same method name
  • Different argument type
  • May have different return types


  • public class Manipulation{ //Super classpublic
  • void add(String name){ //String parameter………………}}
  •  Public class Addition extends Manipulation(){
  • Public void add(){//No Parameter………..}
  • Public void add(int a){ //integer parameter }
  • Public static void main(String args[]){
  • Addition addition = new Addition();addition.add();}}

Here the add() method has different parameters in the Addition class is overloaded in the same class as well as with the super-class.

Note: Polymorphism is not applicable for method overloading.

15) What is meant by Interface?


Multiple inheritances cannot be achieved in java. To overcome this problem Interface concept is introduced.

An interface is a template which has only method declarations and not the method implementation.


  • Public abstract interface IManupulation{ //Interface declaration
  • Public abstract void add();//method declaration
  • public abstract
  • void subtract();}
  • All the methods in the interface are internally public abstract void.
  • All the variables in the interface are internally public static final that is constants.
  • Classes can implement the interface and not extends.
  • The class which implements the interface should provide an implementation for all the methods declared in the interface.
  • public class Manupulation implements IManupulation{ //Manupulation class uses the interface
  • Public void add(){……………}
  • Public void subtract(){…………….}}

    Subscribe For Free Demo

    16) What is meant by Abstract class?


    We can create the Abstract class by using the “Abstract” keyword before the class name. An abstract class can have both “Abstract” methods and “Non-abstract” methods that are a concrete class.

    Abstract method:

    The method which has only the declaration and not the implementation is called the abstract method and it has the keyword called “abstract”. Declarations are the ends with a semicolon.


    • public abstract class Manupulation{
    • public abstract void add();//Abstract method declaration
    • Public void subtract(){}}
    • An abstract class may have a non- abstract method also.
    • The concrete Subclass which extends the Abstract class should provide the implementation for abstract methods.

    17) Difference between Array and Array List.


    The Difference between Array and Array List can be understood from the below table:

      Array List    
    Size should be given at the time of array declaration.
    String[] name = new String[2]
    Size may not be required. It changes the size dynamically.
    ArrayList name = new ArrayList
    To put an object into array we need to specify the index.
    name[1] = “book”
    No index required.
    Array is not type parameterizedArrayList in java 5.0 are parameterized.
    Eg: This angle bracket is a type parameter which means a list of String.

    18) Difference between String, String Builder, and String Buffer.


    String: String variables are stored in a “constant string pool”. Once the string reference changes the old value that exists in the “constant string pool”, it cannot be erased.


    String name = “book”;

    Constant string pool


    If the name-value has changed from “book” to “pen”.

    Constant string pool


    Then the older value retains in the constant string pool.

    String Buffer:

    • Here string values are stored in a stack. If the values are changed then the new value replaces the older value.
    • The string buffer is synchronized which is thread-safe.
    • Performance is slower than the String Builder.


    String Buffer name =”book”;


    Once the name value has been changed to “pen” then the “book” is erased in the stack.


    String Builder:

    This is the same as String Buffer except for the String Builder which is not threaded safety that is not synchronized. So obviously performance is fast.

    19) Explain about Public and Private access specifiers.


    Methods and instance variables are known as members.


    Public members are visible in the same package as well as the outside package that is for other packages.


    Public members in Class A are visible to Class B (same package) as well as Class C (different packages).


    Private members are visible in the same class only and not for the other classes in the same package as well as classes in the outside packages.


    Private members in class A are visible only in that class. It is invisible for class  B as well as class C.

    20) Difference between Default and Protected access specifiers.


    Default: Methods and variables declared in a class without any access specifiers are called default.

    Default members in Class A are visible to the other classes which are inside the package and invisible to the classes which are outside the package.

    So Class A members are visible to the Class B and invisible to the Class C.



    Protected is the same as Default but if a class extends then it is visible even if it is outside the package.

    Class A members are visible to Class B because it is inside the package. For Class C it is invisible but if Class C extends Class A then the members are visible to the Class C even if it is outside the package.

    21) Difference between HashMap and HashTable.


    Difference between HashMap and HashTable can be seen below:

    Methods are not synchronizedKey methods are synchronized
    Not thread safetyThread safety
    Iterator is used to iterate the valuesEnumerator is used to iterate the values
    Allows one null key and multiple null valuesDoesn’t allow anything that is null
    Performance is high than HashTablePerformance is slow

    22)What is the JIT compiler?


    JIT compiler runs after the program is executed and compiles the code into a faster form, hosting CPU’s native instructing set. JIT can access dynamic runtime information, whereas a standard compiler doesn’t and can make better optimizations like inlining functions that are used frequently. 

    23)What do you understand by Java IDEs?


    A Java IDE is a software that allows Java developers to easily write as well as debug Java programs. It is basically a collection of various programming tools, accessible via a single interface, and several helpful features, such as code completion and syntax highlighting. Codenvy, Eclipse, and NetBeans are some of the most popular Java IDEs.

    24)Java is a platform-independent language. Why?


    Java programming language does not depend on any particular hardware or software because it is compiled by the compiler and then converted into byte code. Byte code is platform-independent and can run on multiple systems. The only requirement is Java needs a runtime environment, i.e., JRE, which is a set of tools used for developing Java applications.

    25) Explain Typecasting


    The concept of assigning a variable of one data type to a variable of another data type. It is not possible for the boolean data type.

    It is of two types:

    • Implicit
    • Explicit

    26)Explain different types of typecasting?


    Different types of typecasting are:

    • Implicit: Storing values from a smaller data type to the larger data type. It is automatically done by the compiler.
    • Explicit: Storing the value of a larger data type into a smaller data type. This results in information loss:
    • Truncation
    • Out of Range

    Let us see code samples to further understand this:

    • int i = 10;
    • long l = i;
    • long l = 10,000;
    • int i = (int) l;
    • float f = 3.14f
    • int i = (int) f;
    • i=3;
    • long l = 123456789;
    • byte b = (byte) l;

    27) Explain access modifiers in Java.


    Access modifiers are predefined keywords in Java that are used to restrict the access of a class, method, constructor, and data member in another class.

    Java supports four access modifiers:

    • Default
    • Private
    • Protected
    • Public
    Same classyesyesyesyes
    Same package subclassyesnoyesyes
    Same package non-subclassyesnoyesyes
    Different package subclassnonoyesyes
    Different package non-subclassnononoyes

    28) What are the default values for local variables


    The local variables are not initialized to any default value, neither primitives nor object references.

    29) What’s the difference between an array and Vector?


    An array groups data of same primitive type and is static in nature while vectors are dynamic in nature and can hold data of different data types.

    30) What is multi-threading?


    Multi threading is a programming concept to run multiple tasks in a concurrent manner within a single program. Threads share same process stack and running in parallel. It helps in performance improvement of any program.

    Course Curriculum

    Get Hands-On Learning on Java Training and Master Your Skills

    • Instructor-led Sessions
    • Real-life Case Studies
    • Assignments
    Explore Curriculum

    31) Why Runnable Interface is used in Java?


    Runnable interface is used in java for implementing multi threaded applications. Java.Lang.Runnable interface is implemented by a class to support multi threading.

    32) What are the two ways of implementing multi-threading in Java?


    Multi threaded applications can be developed in Java by using any of the following two methodologies:

    • By using Java.Lang.Runnable Interface. Classes implement this interface to enable multi threading. There is a Run() method in this interface which is implemented.
    • By writing a class that extend Java.Lang.Thread class.

    33)When a lot of changes are required in data, which one should be a preference to be used? String or StringBuffer?


    Since StringBuffers are dynamic in nature and we can change the values of StringBuffer objects unlike String which is immutable, it’s always a good choice to use StringBuffer when data is being changed too much. If we use String in such a case, for every data change a new String object will be created which will be an extra overhead.

    34) What’s the purpose of using Break in each case of Switch Statement?


    Break is used after each case (except the last one) in a switch so that code breaks after the valid case and doesn’t flow in the proceeding cases too.

    If break isn’t used after each case, all cases after the valid case also get executed resulting in wrong results.

    35) How garbage collection is done in Java?


    In java, when an object is not referenced any more, garbage collection takes place and the object is destroyed automatically. For automatic garbage collection java calls either System.gc() method or Runtime.gc() method.

    36) How we can execute any code even before main method?


    If we want to execute any statements before even creation of objects at load time of class, we can use a static block of code in the class. Any statements inside this static block of code will get executed once at the time of loading the class even before creation of objects in the main method.

    37) Can a class be a super class and a sub-class at the same time? Give example.


    If there is a hierarchy of inheritance used, a class can be a super class for another class and a sub-class for another one at the same time.

    In the example below, continent class is sub-class of world class and it’s super class of country class.

    38) How objects of a class are created if no constructor is defined in the class?


    Even if no explicit constructor is defined in a java class, objects get created successfully as a default constructor is implicitly used for object creation. This constructor has no parameters.

    39) In multi-threading how can we ensure that a resource isn’t used by multiple threads simultaneously?


    In multi-threading, access to the resources which are shared among multiple threads can be controlled by using the concept of synchronization. Using synchronized keyword, we can ensure that only one thread can use shared resource at a time and others can get control of the resource only once it has become free from the other one using it.

    40) Can we call the constructor of a class more than once for an object?


    Constructor is called automatically when we create an object using new keyword. It’s called only once for an object at the time of object creation and hence, we can’t invoke the constructor again for an object after its creation.

    41) There are two classes named classA and classB. Both classes are in the same package. Can a private member of classA can be accessed by an object of classB?


    Private members of a class aren’t accessible outside the scope of that class and any other class even in the same package can’t access them.

    42) Can we have two methods in a class with the same name?


    We can define two methods in a class with the same name but with different number/type of parameters. Which method is to get invoked will depend upon the parameters passed.

    For example in the class below we have two print methods with same name but different parameters. Depending upon the parameters, appropriate one will be called:

    43) How can we make copy of a java object?


    We can use the concept of cloning to create copy of an object. Using clone, we create copies with the actual state of an object.

    Clone() is a method of Cloneable interface and hence, Cloneable interface needs to be implemented for making object copies.

    44) What’s the benefit of using inheritance?


    Key benefit of using inheritance is reusability of code as inheritance enables sub-classes to reuse the code of its super class. Polymorphism (Extensibility ) is another great benefit which allow new functionality to be introduced without effecting existing derived classes.

    45) What’s the default access specifier for variables and methods of a class?


    Default access specifier for variables and method is package protected i.e variables and class is available to any other class but in the same package,not outside the package.

    46) Give an example of use of Pointers in Java class.


    There are no pointers in Java. So we can’t use concept of pointers in Java.

    47) How can we restrict inheritance for a class so that no class can be inherited from it?


    If we want a class not to be extended further by any class, we can use the keyword Final with the class name.

    In the following example, Stone class is Final and can’t be extend

    48) What’s the access scope of Protected Access specifier?


    When a method or a variable is declared with Protected access specifier, it becomes accessible in the same class,any other class of the same package as well as a sub-class.

    no modifierYYNN

    49) What’s difference between Stack and Queue?


    Stack and Queue both are used as placeholder for a collection of data. The primary difference between a stack and a queue is that stack is based on Last in First out (LIFO) principle while a queue is based on FIFO (First In First Out) principle.

    50) In java, how we can disallow serialization of variables?


    If we want certain variables of a class not to be serialized, we can use the keyword transient while declaring them. For example, the variable trans_var below is a transient variable and can’t be serialized:

    Course Curriculum

    Enroll in Java Certification Course with In-Depth Modules By Certified Experts

    Weekday / Weekend BatchesSee Batch Details

    51) How can we use primitive data types as objects?


    Primitive data types like int can be handled as objects by the use of their respective wrapper classes. For example, Integer is a wrapper class for primitive data type int. We can apply different methods to a wrapper class, just like any other object.

    52) Which types of exceptions are caught at compile time?


    Checked exceptions can be caught at the time of program compilation. Checked exceptions must be handled by using try catch block in the code in order to successfully compile the code.

    53) Describe different states of a thread.


    A thread in Java can be in either of the following states:

    • Ready: When a thread is created, it’s in Ready state.
    • Running: A thread currently being executed is in running state.
    • Waiting: A thread waiting for another thread to free certain resources is in waiting state.
    • Dead: A thread which has gone dead after execution is in dead state.

    54) Can we use a default constructor of a class even if an explicit constructor is defined?


    Java provides a default no argument constructor if no explicit constructor is defined in a Java class. But if an explicit constructor has been defined, default constructor can’t be invoked and developer can use only those constructors which are defined in the class.

    55) Does Java support operator overloading?


    Operator overloading is not supported in Java.

    56) Can we overload a method by just changing the return type and without changing the signature of method?


    No, We cannot do this. To overload a method, the method signature must be different, return type doesn’t play any role in method overloading.

    57) Is it possible to overload main() method of a class?


    Yes, we can overload main() method in Java.

    58) What is the difference between method overloading and method overriding?


    Refer this guide: Overloading vs overriding in Java

    59) What is static and dynamic binding in Java?


    Binding refers to the linking of method call to its body. A binding that happens at compile time is known as static binding while binding at runtime is known as dynamic binding. Refer: Static and Dynamic binding in Java.

    60) What is Encapsulation?


    Wrapping of the data and code together is known as encapsulation. Refer: Java Encapsulation.

    61) What is an abstract class in Java?


    An abstract class is a class which can’t be instantiated (we cannot create the object of abstract class), we can only extend such classes. It provides the generalised form that will be shared by all of its subclasses, leaving it to each subclass to fill in the details. We can achieve partial abstraction using abstract classes, to achieve full abstraction we use interfaces.

    62) What is Interface in java?


    An interface is used for achieving full abstraction. A class implements an interface, thereby inheriting the abstract methods of the interface. Refer: Java Interface

    63) What is the difference between abstract class and interface?


    • abstract class can have abstract and non-abstract methods. An interface can only have abstract methods.
    • An abstract class can have static methods but an interface cannot have static methods.
    • abstract class can have constructors but an interface cannot have constructors.

    64) Name the access modifiers that can be applied to the inner classes?


    public ,private , abstract, final, protected.

    65) What is a constructor in Java?


    Constructor is used for creating an instance of a class, they are invoked when an instance of class gets created. Constructor name and class name should be same and it doesn’t have a return type. Refer this guide: Java Constructor.

    66) Can we inherit the constructors?


    No, we cannot inherit constructors.

    67) Can we mark constructors final?


    No, Constructor cannot be declared final.

    68) What is default and parameterized constructors?


    • Default: Constructors with no arguments are known as default constructors, when you don’t declare any constructor in a class, compiler creates a default one automatically.
    • Parameterized: Constructor with arguments are known as parameterized constructors.

    69) Can a constructor call another constructor?


    Yes. A constructor can call the another constructor of same class using this keyword. For e.g. this() calls the default constructor.

    Note: this() must be the first statement in the calling constructor.

    70) Can a constructor call the constructor of parent class?


    Yes. In fact it happens by default. A child class constructor always calls the parent class constructor. However we can still call it using super keyword. For e.g. super() can be used for calling super class default constructor.

    Note: super() must be the first statement in a constructor.

    71)THIS keyword?


    The this keyword is a reference to the current object.

    72) Can this keyword be assigned null value?


    No, this keyword cannot have null values assigned to it.

    73) Explain ways to pass the arguments in Java?


    In java, arguments can be passed as call by value – Java only supports call by value, there is no concept of call by reference in Java.

    74) What is static variable in java?


    Static variables are also known as class level variables. A static variable is same for all the objects of that particular class in which it is declared.

    75) What is static block?


    A static block gets executed at the time of class loading. They are used for initializing static variables.

    Java Sample Resumes! Download & Edit, Get Noticed by Top Employers! Download

    76) What is a static method?


    Static methods can be called directly without creating the instance (Object) of the class. A static method can access all the static variables of a class directly but it cannot access non-static variables without creating instance of class.

    77) Explain super keyword in Java?


    super keyword references to the parent class. There are several uses of super keyword:

    • It can be used to call the superclass(Parent class) constructor.
    • It can be used to access a method of the superclass that has been hidden by subclass (Calling parent class version, In case of method overriding).
    • To call the constructor of parent class.

    78) Use of final keyword in Java?


    • Final methods – These methods cannot be overridden by any other method.
    • Final variable – Constants, the value of these variable can’t be changed, its fixed.
    • Final class – Such classes cannot be inherited by other classes. These type of classes will be used when application required security or someone don’t want that particular class. Final Keyword in Java.

    79) What is a Object class?


    This is a special class defined by java; all other classes are subclasses of object class. Object class is superclass of all other classes. Object class has the following methods

    • objectClone () – to creates a new object that is same as the object being cloned.
    • boolean equals(Object obj) – determines whether one object is equal to another.
    • finalize() – Called by the garbage collector on an object when garbage collection determines that there are no more references to the object. A subclass overrides the finalize method to dispose of system resources or to perform other cleanup.
    • toString () – Returns a string representation of the object.

    80) What are Packages in Java?


    A Package can be defined as a grouping of related types (classes, interfaces, enumerations and annotations). Refer: Package in Java.

    81)What is the difference between import java.util.Date and java.util.* ?


    The star form (java.util.* ) includes all the classes of that package and that may increase the compilation time – especially if you import several packages. However it doesn’t have any effect run-time performance.

    82) What is static import?


    Refer: Static Import in Java.

    83) Garbage collection in java?


    Since objects are dynamically allocated by using the new operator, java handles the de-allocation of the memory automatically, when no references to an object exist for a long time. This whole process is called garbage collection. The whole purpose of Garbage collection is efficient memory management.

    84)What do you think are the advantages of using Java?


    Java is a high-level object-oriented programming language used for developing games, device systems, and applications.

    It is secure, fast, reliable, portable and platform independent.

    85)What do you understand by Object and Class?


    An object is understood as a collection of methods and classes which represent its state and executes operations.

    A class is used to define new types of data which in turn is used to create objects.

    86) What are JVM, JDK, and JRE?


    • JVM (Java Virtual Machine) offers the runtime environment for codes to be executed.
    • JRE (Java Runtime Environment) is the collection of files needed during runtime by JVM.
    • JDK (Java Development Kit) is needed to write and execute a program and contains the JRE with necessary development tools.

    87) What is meant by looping?


    Loops are used to repeatedly execute a certain statement or block of statements.

    They are of three types- For Loops, While Loops and Do While Loops.

    88) What is the difference between Overloading and Overriding?


    When you have two methods of the same name but having different properties, the case is called Overloading. On the other hand, Overriding refers to a situation where two methods with the same name and properties occur, but the two occurring in a parent and child class respectively.

    89) What is Inheritance?


    Inheritance allows you to let a derived class acquire the methods from a base class.

    90) Is it possible to restrict Inheritance?


    Yes, it is. You can restrict Inheritance by:

    • Using the final keyword.
    • Making the method final.
    • Using private constructor.
    • Using (//) Javadoc comment.

    91) What do you mean by Content Negotiation?


    Content negotiation occurs between you as a user and the host server. For instance, when you make an HTTP request you receive your result in different languages and formats, and you can specify what content you will accept back from the host in a negotiation of the type of content shared.

    92) What is WORA?


    WORA or Write Once Read Anywhere, is the property of a language to run on any platform. Java is allowed this property due to its bytecode nature. This is midway between machine code and source code and is thus not platform specific.

    93) What is the function of ClassLoader?


    You can use ClassLoader to load class files before running the java program.

    94) What are static methods and static variables?


    They are methods and variables shared by all the objects in a class. Their static nature is a character of the class and not the object itself.

    95) What do you understand by the Object-Oriented Paradigm?


    When your programming paradigm is dependent on objects containing data with methods defined within the class to which they belong, it is referred to as Object Oriented Paradigm.

    96) Is there a difference between Object Oriented and Object-Based language?


    Object Oriented languages such as Java and C++ follow all the concepts of an Object Oriented Program and do not have inbuilt objects.

    Object-Based languages like JavaScript do not follow all OOPs concepts-such as inheritance-and do have I built objects.

    97) What is the function of a constructor?


    You can use constructors to initialize the state of any object. When you create a new object using a new keyword, a default constructor is invoked. This must have a name similar to the class name.

    98)How do you use ‘this’ keyword?


    You can use ‘this’ to refer to a current object, invoke the current class method or class constructor. You can also pass it on as an argument into your methods or constructors.

    99) What is aggregation?


    It is a type of weak relation you can create between two classes, where one contain references to another class contained within it.

    100) What is the purpose of composition?


    You can use composition to hold the reference of one class within another class, and in this case, the contained object cannot exist without the class containing it. It is a type of aggregation.

    Are you looking training with Right Jobs?

    Contact Us
    Get Training Quote for Free