Core Java

Core Java

What is the most important feature that makes Java different to other language?
Platform independent feature makes Java different to other language.

What is  platform independence means ?
It means that we can write and compile the code of java in one platform (example: Windows) and execute the class in another supported platform (example: Linux, Solaris, etc).

What is a JVM?
JVM is Java Virtual Machine which provides a platform for executing compiled java class files (known as byte code).

What makes Java platform independent?
Byte code is a compiled class of java and identical for same source code irrespective of operating systems. JVM’s are operating system specific run time implementation provided by the vendor.
JVM makes Java platform independent because it execute byte codes on same way as other JVM does.

Distinguish between a JDK, JVM and JRE?
JDK stands for Java Development Kit which is for development use and it includes compiler and execution environment.
JVM stands for a run time environment and not able to compile source files using a JVM.
JRE i.e. Java Runtime Environment provides JVM , libraries, and different components to run an applications  which are written in the Java programming language.
And the deployment technologies are two that are part of the JRE: Java Plug-in that enables applets to run in well-known browsers; and Java Web Start, that deploys standalone applications over a network.
It is the base for the technologies in the J2EE for enterprise software development and deployment.For developing applets and applications the JRE does not contain tools and utilities for example: compilers or debuggers.

What is a pointer and how Java handles pointers?
To a memory location pointer is a reference handle and it’s improper handling leads to memory leaks and reliability issues so Java doesn’t allow pointers for handling while Java have own memory management tools that manage it internally.

What is the base class of all classes and their methods?
java.lang.Object is the base class of java.
Methods
clone() For the same class creates a new object .
equals(Object) Compares the two Objects for equality.
finalize() on an object called by the garbage collector when garbage collection conclude that there are no more references to the object.
getClass() Returns the runtime class.
hashCode() For an object returns a hash code value.
notify() Wakes up a single thread that’s waiting on an object’s monitor.
notifyAll() Wakes up all threads that’s waiting on an object’s monitor.
toString() Returns a string representation .
wait() Waits to be notified by other thread of a change in the object.
wait(long) Waits to be notified by other thread of a change in the object.
wait(long, int) Waits to be notified by other thread of a change in the object.

Explain the use of bin and lib in JDK ?
A bin contains all tools like appletviewer, javac, awttool, etc whereas lib contains API and all packages.

Write the difference between Initialization and Assignment ?
Initialization can be done only once whereas Assignment can be done as many times as desired.