en
Vibrant Publishers

CORE JAVA Interview Questions You'll Most Likely Be Asked

Obavesti me kada knjiga bude dodata
Da biste čitali ovu knjigu otpremite EPUB ili FB2 datoteku na Bookmate. Kako da otpremim knjigu?
  • Elvin Mahmudovje citiraoпре 5 година
    8: How will you define Synchronization?

    Answer:

    Synchronization is a locking mechanism which is used to control the threads. For example, if multiple threads try to access a shared resource at the same time, then we need some way for the resource to be accessed by only one Thread at a time. So, the main purpose of Synchronization is to protect and secure data.
  • Elvin Mahmudovje citiraoпре 5 година
    e can create threads in two ways as described below:

    a) By extending “Thread” class

    b) By implementing the interface called “Runnable”
  • Elvin Mahmudovje citiraoпре 5 година
    hat is the difference between wait() and sleep()?

    Answer:

    The sleep(n) asks the thread to wait for a specific amount of time. The thread wakes up exactly after the specified amount of time. The wait(x) method keeps the thread waiting for maximum specified amount of time. It may be invoked by a notify() or notifyAll() method anytime before the specified time.
  • Elvin Mahmudovje citiraoпре 5 година
    There are three types of exceptions we need to take care of. They are:

    a) Runtime Exception or Unchecked Exception: These type of exceptions occur during run time as we don’t write code to handle exceptions

    b) Checked Exception: These types of exceptions are handled using try, catch, finally, throw or throws keyword.

    c) Error: It is the behavior which stops the working of the system during program execution.
  • Elvin Mahmudovje citiraoпре 5 година
    Garbage collection is an automatic feature which takes care of memory management in Java.

    Whenever the objects are declared null or if the objects are no longer used in a program, the Java Virtual machine clears those objects from memory and thereby make the system clean.
  • Elvin Mahmudovje citiraoпре 5 година
    We need to understand three features while invoking overloaded methods. They are

    a) Widening: This feature always chooses the maximum range of bytes. For example, Long type holds maximum amount of bytes than Integer.

    b) Autoboxing: This feature converts the primitive to wrapper and vice versa.

    c) Var-args: Using this feature, we can pass multiple arguments to a method by passing single argument with three dots as shown below:

    public static String invokeFormat(String strPattern,Object... myArgs);

    As per the above order, Widening overcomes Autoboxing and Var-Args and Autoboxing overcomes Var-args.
  • Elvin Mahmudovje citiraoпре 5 година
    Garbage Collection is done in the Heap Memory.
  • Elvin Mahmudovje citiraoпре 5 година
    “default” it gets executed and executes the next statement as well.
fb2epub
Prevucite i otpustite datoteke (ne više od 5 odjednom)