Object oriented Basic theory
Some Question Answer about core Java and basic object oriented theory and some Interview level Questions for Students.
Java is platform independence – Explain.
We can write a java program in any platform or operating system. After compiling this java code converted into byte code. This code can interpret in any platform or operating system if and only if that platform is JVM supported. That is we can write java program in Windows and run it in Linux. That is why java known as platform independence
What is JVM and is it platform independent?
The heart of java programming is Java Virtual Machine (JVM). The main function of the JVM is converting byte code into machine readable code. JVM is not platform independent. Each and every operating system have their own JVM. But byte code is same for every JVM, after reading bytecode each JVM convert it into executable code as per operating system. JVM is called virtual because it provides an interface that doesn’t depend on the underlying OS.
What is the difference between JDK and JVM?
Java Development Kit (JDK) is used for java development. JVM is a part of JDK. JVM used to converting byte code into machine readable code.
JDK manage all the requirement (executables, binaries and tools) needs for debug, compile or execute a Java Program. But JVM handled the execution part of the java program.
What is the difference between JVM and JRE?
The implementation of JVM is known as Java Runtime Environment (JRE). It consists of various java binaries, other classes and JVM to execute any program successfully. JRE doesn’t contain any development tools like java debugger, compiler, etc. Without JRE we can’t execute any java program. After compiling the java program JRE is need for execute the byte code in any system.
Why Java is not pure Object Oriented language?
Java supports primitive data types like int, char, byte, float, double etc. That is why java is not consider as pure object oriented language.
This allowance of primitive data types is due to the simplicity of the language while writing our code. But each and every primitive data type backe up by a class called Wrapper class.
What is the importance of main method in Java?
main() method is the entry point of any standalone java program. The syntax of main method is
public static void main(String args).
public – This method is public due to make it’s accessibility globally.
static – To call the main method without create any object.