Can we pass a primitive type by reference in java? - Java Primitive types can be passed by reference. 1. By storing the primitive type value in an array of single element and passing it... What do you mean by the term signature in java? A signature in java is a combination of elements in a list such as constructor and methods thereby distinguishing them from other constructors and methods... Static nested class vs. a non-static one - Java A static nested class can not directly access non-static methods or fields of an instance of its enclosing class... When we should make an instance variable private - Java An instance variable can be declared as private to promote information hiding. So that no other object can access them... Overridden methods in Java Overridden methods of super class in subclass allow a class to inherit and behave close enough... Is C++ access specifier called protected is similar to Java’s? The java access specifier ‘protected’ is placed proceeding the member of the class and the access control is applicable only for that particular definition... Why should we catch super class exceptions? Every exception is represented by the instance of Throwable or its subclasses. An object can carry the information for the exception raising point to the exception handler which catches it... Why would we manually throw an exception? When an exception is to be handled which are not java class library, a user defined exception can be thrown... What is chained exceptions in java? Once an application finds an exception, responds an exception by throwing another exception. It causes another exception. Knowing an exception that causes another exception is very useful... When should we create our own custom exception classes? - Java The term exception lets the programmer to know that there is something exceptional has occurred in the program. Apart from Java exception class library, a custom exception can be created by the developer... What are primitive type wrappers classes? - Java Primitive type wrapper classes or simply wrapper classes are available in java.lang package for providing object methods for all the eight primitive types. All the wrapper class objects are immutable... Why do you recommend that the main thread be the last to finish? - Java In an application, a program continues to run until all of the threads have ended. Hence, the main thread to finish at last is not a requirement. It is a good programming practice to make it to run last to finish... Why does Java have two ways to create child threads? Java threads can be created graciously in two ways: implementing the Runnable interface and extending Thread class... Tips on effectively using Multithreading - Java In multiple processor systems, a large algorithm will split the process into threads. So that different processors can handle different threads... Enumerations vs final variables in java Enumeration is type safe. Where as final variables are not. Enumeration supports to have a blend of various values. Where as final variables does not support multiple values... Output to an applet’s window - Java Yes it is possible for a method other than paint() or update() to output an applet’s window. It is mandatory to obtain a graphics context by invoking getGraphics() method... What is byte code? - Java The compiled Java source code is known as byte code. Java compiler generates the byte code... Range and behavior of its primitive types - Java Java strictly specifies the ranges for primitive values. The selection of values in integer or floating point types differs based on the requirement of an application... What is Java’s character type? The char data type in Java is a single 16-bit Unicode character. It represents a character that could be any one of the world languages... Difference between the prefix and postfix forms - Java The prefix operator ++ adds one to its operand / variable and returns the value before it is assigned to the variable. In other words, the increment takes place first and the assignment next... String methods indexOf() and lastIndexOf() - Java The method indexOf() returns the first occurrence (index) of a given character or a combination as parameter in a given string... Difference between protected and default access - Java The default access specifier is one which is not specified with a key word. If no access specifier (any one of private, protected, public) is mentioned it is known as the default access specifier... Ways that the members of a package can be used by other packages - Java There are two ways of affecting access levels. One, when the classes in the Java platform are used within the developer defined classes, the access levels determine the members of those class which can be used by the developer defined classes... Explain Java’s delegation event model - Java The event model is based on the Event Source and Event Listeners. Event Listener is an object that receives the messages / events. The Event Source is any object which creates the message / event... Describe the assert keyword - Java The programmer assumes certain code while developing when handling exceptions. For example, a number is passed as parameter to a method and it is to be validated whether it is positive... Why a native method might be useful? - Java Java Native methods are useful when an application can not be written completely in Java language. For instance, when a Java application needs to modify an existing application which was developed in another language... Use of shift operator in Java Using shift operators in Java we can 1. Integer division and multiplication is done faster... Need of wrappers like Integer, Boolean for int, boolean - Java Wrapper classes are used to represent primitive data types as objects. Dealing primitive types as objects is sometimes easier.... Array vs ArrayList vs LinkedList vs Vector in java Array vs ArrayList: ArrayList is much better than Array, when the size need to be increased dynamically. Efficiency is possible with arrays. ArrayList permits null elements... Define Autoboxing with an example The automatic conversion of primitive int type into a wrapper class object is called autoboxing. It does not require to type cast the int value. The modification of primitive wrapper objects is done directly... Can Java communicate with ActiveX objects? - Java Java can communicate with ActiveX objects by using Bridge2Java from IBM. Bridge2Java is a tool for allowing the java applications for communicating with ActiveX objects... What is CLASSPATH variable? What is default classpath? - Java CLASSPATH is an environment variable that communicates JVM and other java applications for finding the java language class libraries, including the developer’s class library. It is set by setenv command like... Explain how to convert any Java Object into byte array? - Java 1. Create an object of ByteArrayOutputStream class. ByteArrayOutputStream bStream = new ByteArrayOutputStream();.. Explain how to convert bytes[] into File object - Java 1. Create a File object. File file = new File(“path and file name here”);... JavaSpaces technology vs. database - Java Java spaces is a technology with powerful high-level tool for the development of distributed and collaborative applications. A simple API is provided based on the network shared space for developing sophisticated distributed applications... Methods for accessing system properties about the Java virtual machine The system properties are accessed by the method System.getProperties(). This method returns a Properties object... Difference between add() and addElement() in Vector - Java The add() methods inserts an element at a given position of the vector... What is difference between sets and lists? - Java Sets can have unique values. Lists can have duplicate values... What is fail-fast iterator in Java? What is it used for? The unsynchronized collections and their modifications, iterations are termed as ‘fail-fast’ iterators. An iterator that implements Iterable interface... How to store and retrieve serialized objects to and from a file in Java? The object’s current state can be persisted and retrieved by using the concept known as ‘serialization’. This is done on an object to a stream... What is relation between JAXP and Xerces? - Java Xerces is a group of libraries for parsing, serializing, validating and manipulating XML... What type of garbage collection does a System.gc() do? - Java Among various types of garbage collections, the System.gc() performs an explicit collection of garbage calls. The other garbage collection types are:... When do I need to use reflection feature in Java? Reflection feature in java allows an executing java program for introspecting upon itself. It also allows for manipulating internal properties of the program... Explain how to measure time in nanoseconds - Java Time is measured in nanoseconds by using the method nanoTime() method. This method returns the current value of the most precise system timer available in nanoseconds... Java Thread: run() vs start() method The method start() invokes the run() method. If the run() method of two threads invoked separately, they will execute one after the other... What is Java Isolates and why do we need it? Java Isolates is an API. It provides a mechanism to manage Java application life cycles which are isolated from each other. They can potentially share the underlying implementation resources... What are the system properties that applets are allowed to read by default? The following are the system properties that Java applets read by default with System.getProperty() method:... What is jvmstat? The jvmstat is a technology for adding light weight performance, configuration instrumentation to the HotSpot JVM. The jvmstat provides... Describe how to implement singleton design pattern in struts A singleton implementation is done using action class in struts framework. It performs as a front controller and every request will go through it... Difference between length and length()? - Java The ‘length’ is an instance constant which is the size of an array. While the ‘length()’ is a method that returns the no. of the characters in a string...