Free Online Books and PDFs for Web Designers
Powered by MaxBlogPress  

5 Java Programming Test Questions for Interview

Recently I am taking a lot of interview for my organization. So I was in the search of some java programming test questions that are little bit tricky also. Here I am providing five of the tricky questions I found interesting and need a closer look to understand. The explanation will be provided after the questions. Test your knowledge of java by trying to provide the answer of the below test questions. . . . → Read More: 5 Java Programming Test Questions for Interview

Java Interview Questions: Understanding and Extending Java ClassLoader

The Java ClassLoader is one of the crucial but rarely used components of Java in Project Development. Personally I have never extended ClassLoader in any of my projects but the idea of having my own ClassLoader that can customize the Java Class Loading thrills me. This article will provide an overview of Java Class Loading and then move forward to create a custom ClassLoader and use it. What is a ClassLoader? We know that Java Program runs on Java Virtual Machine (JVM). When we compile a Java Class, it transforms it in the form of bytecode that is platform and machine independent compiled program and store it as a .class file. After that when we try to use a Class, Java ClassLoader loads that class into memory. There are three types of built-in Class Loaders in Java: 1. Bootstrap Class Loader – It loads JDK internal classes, typically loads rt.jar and other core classes for example java.lang.* package classes 2. Extensions Class Loader – It loads classes from the JDK extensions directory, usually $JAVA_HOME/lib/ext directory. 3. System Class Loader – It loads classes from the current classpath that can be set while invoking a program using -cp or -classpath command line options. Java Class Loaders are hierarchical and whenever a request is raised to load a class, it delegates it to its parent and in this way uniqueness is maintained in the runtime environment. If the parent class loader doesn’t find the class then the class loader itself tries to load the class. . . . → Read More: Java Interview Questions: Understanding and Extending Java ClassLoader

Understanding Java Object cloning and when to override it

Java Object class comes with native clone() method that returns the copy of the existing instance. To use java cloning, all you need is to implement the marker interface java.lang.Cloneable so that it won’t throw CloneNotSupportedException at runtime. So if clone() function returns the object copy, why do we need to over-write it and in which cases? . . . → Read More: Understanding Java Object cloning and when to override it