- What is a platform?
A platform is the hardware or software environment in which a program runs. Most platforms can be described as a combination of the operating system and hardware, like Windows 2000/XP, Linux, Solaris.
- What is the main difference between Java platform and other platforms?
The Java platform differs from most other platforms in that it's a software-only platform that runs on top of other hardware-based platforms.
The Java platform has two components:
- The Java Virtual Machine (Java VM)
- The Java Application Programming Interface (Java API)
- What is the Java Virtual Machine?
The Java Virtual Machine is software that can be ported onto various hardware-based platforms
- What is the Java API?
The Java API is a large collection of ready-made software components that provide many useful capabilities, such as graphical user interface widgets.
- What is the package?
The package is a Java name-space or part of Java libraries. The Java API is grouped into libraries of related classes and interfaces; these libraries are known as packages.
- What is native code?
The native code is code that after you compile it, the compiled code runs on a specific hardware platform.
What is the difference between an Interface and an Abstract class? An Abstract class declares have at least one instance method that is declared abstract which will be implemented by the subclasses. An abstract class can have instance methods that implement a default behavior. An Interface can only declare constants and instance methods, but cannot implement default behavior.
7. What is the purpose of garbage collection in Java, and when is it used?
The purpose of garbage collection is to identify and discard objects that are no longer needed by a program so that their resources can be reclaimed and reused. A Java object is subject to garbage collection when it becomes unreachable to the program in which it is used.
8. What is the serialization?
The serialization is a kind of mechanism that makes a class or bean persistent by having its properties or fields and state information saved and restored to and from storage.
9. What is a transient variable?
A transient variable is a variable that may not be serialized. If you don't want some field to be serialized, you can mark that field transient or static
10. Which class is the super class for every class?
Object
11. What is thread?
A thread is an independent path of execution in a system.
12. What is multithreading?
Multithreading means various threads that run in a system.
13. How does multithreading take place on a computer with a single CPU?
The operating system's task scheduler allocates execution time to multiple tasks. By quickly switching between executing tasks, it creates the impression that tasks execute sequentially.
14. How to create multithread in a program?
You have two ways to do so. First, making your class "extends" Thread class. Second, making your class "implements" Runnable interface. Put jobs in a run () method and call start () method to start the thread.
15. Can Java object be locked down for exclusive use by a given thread?
Yes. You can lock an object by putting it in a "synchronized" block. The locked object is inaccessible to any thread other than the one that explicitly claimed it.
- What state does a thread enter when it terminates its processing?
When a thread terminates its processing, it enters the dead state.
- What invokes a thread's run () method?
After a thread is started, via its start () method of the Thread class, the JVM invokes the thread's run () method when the thread is initially executed.
- What is the purpose of the wait (), notify (), and notify All () methods?
The wait (), notify (), and notify All () methods are used to provide an efficient way for threads to communicate each other.
- What are the high-level thread states?
The high-level thread states are ready, running, waiting, and dead.
20 What is the difference between an Interface and an Abstract class?
An Abstract class declares have at least one instance method that is declared abstract which will be implemented by the subclasses. An abstract class can have instance methods that implement a default behavior. An Interface can only declare constants and instance methods, but cannot implement default behavior.