Core Java: Basics of Java Interview Questions: 1) What Is Difference Between JDK, JRE and JVM? JVM
Core Java: Basics of Java Interview Questions: 1) What Is Difference Between JDK, JRE and JVM? JVM
JRE
JR stands for Java Runtime nvironment. !t is the implementation of JVM and physically exists.
JDK
J"# is an acronym for Java "evelopment #it. !t physically exists. !t contains JR $ development tools. more details...
-)What is '(atfor%"
( platform is basically the hardware or software environment in which a pro0ram runs. 3here are two types of platforms software7based and hardware7based. Java provides software7based platform.
.)What is the %ain difference between Java '(atfor% and other '(atfor%s"
3he Java platform differs from most other platforms in the sense that it8s a software7based platform that runs on top of other hardware7based platforms.!t has two components% &. Runtime nvironment ). (/!((pplication /ro0rammin0 !nterface)
/)What 0ives Java its 1write once and run an&where1 nature"
3he bytecode. Java is compiled to be a byte code which is the intermediate lan0ua0e between source code and machine code. 3his byte code is not platorm specific and hence can be fed to any platform.
2)What is c(ass(oader"
3he classloader is a subsystem of JVM that is used to load classes and interfaces.3here are many types of classloaders e.0. 9ootstrap classloader, xtension classloader, ,ystem classloader, /lu0in classloader etc.
1:)If I do not 'rovide an& ar0u%ents on the co%%and (ine, then the ;trin0 arra& of !ain %ethod wi(( be e%'t& or nu(("
!t is empty. 9ut not null.
1))What is difference between ob5ect oriented 'ro0ra%%in0 (an0ua0e and ob5ect based 'ro0ra%%in0 (an0ua0e"
>bject based pro0rammin0 lan0ua0es follow all the features of >>/s except !nheritance. xamples of object based pro0rammin0 lan0ua0es are Java,cript, V9,cript etc.
1-)What wi(( be the initia( va(ue of an ob5ect reference which is defined as an instance variab(e"
3he object references are all initiali<ed to null in Java.
1.)What is constructor"
'onstructor is just li-e a method that is used to initiali<e the state of an object. !t is invo-ed at the time of object creation.
more details...
3he default constructor provides the default values to the objects. 3he java compiler creates a default constructor only if there is no constructor in the class.more details...
static variable is used to refer the common property of all objects (that is not uni?ue for each object) e.0. company name of employees,colle0e name of students etc. static variable 0ets memory only once in class area at the time of class loadin0.
more details...
( static method belon0s to the class rather than object of a class. ( static method can be invo-ed without the need for creatin0 an instance of a class. static method can access static data member and can chan0e the value of it.
more details...
!s used to initiali<e the static data member. !t is excuted before main method at the time of classloadin0.
more details...
#.)What if the static %odifier is re%oved fro% the si0nature of the %ain %ethod"
/ro0ram compiles. 9ut at runtime throws an error @2o,uchMethod rror@.
+)2on7static (instance) members cannot be accessed in static and non7static variables both static context (static method, static bloc- and static nested can be accessed in instance class) directly. methods. .)Aor example% public static int cube(int n)B return nCnCnDE Aor example% public void ms0() B...E.