Skip to main content

Posts

Showing posts from June, 2011

Java Threads Interview Questions

What are three ways in which a thread can enter the waiting state? Or What are different ways in which a thread can enter the waiting state? A thread can enter the waiting state by the following ways: 1. Invoking its sleep() method, 2. By blocking on I/O 3. By unsuccessfully attempting to acquire an object's lock 4. By invoking an object's wait() method. 5. It can also enter the waiting state by invoking its (deprecated) suspend() method. What is the difference between yielding and sleeping? When a task invokes its yield() method, it returns to the ready state, either from waiting, running or after its creation. When a task invokes its sleep() method, it returns to the waiting state from a running state. How to create multithreaded program? Explain different ways of using thread? When a thread is created and started, what is its initial state? Or Extending Thread class or implementing Runnable Interface. Which is better? You have two ways to do so. First, making you

Java Object Serializarion Interview Questions

Serialization is another important topic that needs to be well prepared whe n you are going fro interview. We have collected important topics that are asked by interview panel of one of the major companies. Just check them below How many methods in the Serializable interface? Which methods of Serializable interface should I implement? There is no method in the Serializable interface. It’s an empty interface which does not contain any methods. The Serializable interface acts as a marker, telling the object serialization tools that the class is serializable. So we do not implement any methods.  What is the difference between Serializalble and Externalizable interface? How can you control over the serialization process i.e. how can you customize the seralization process? When you use Serializable interface, your class is serialized automatically by default. But you can override writeObject() and readObject() two methods to control more complex object serailization process. When you

What is Maven? What Are The Features It Has?

Maven, a Yiddish word meaning accumulator of knowledge, was originally started as an attempt to simplify the build processes in the Jakarta Turbine project. There were several projects each with their own Ant build files that were all slightly different and JARs were checked into CVS. We wanted a standard way to build the projects, a clear definition of what the project consisted of, an easy way to publish project information and a way to share JARs across several projects. The result is a tool that can now be used for building and managing any Java-based project. We hope that we have created something that will make the day-to-day work of Java developers easier and generally help with the comprehension of any Java-based project. Maven's Objectives Maven's primary goal is to allow a developer to comprehend the complete state of a development effort in the shortest period of time. In order to attain this goal there are several areas of concern that Maven attempts to deal wi

Java Collections Interview Questions -Latest

For any java professional Collections Framework is important subject to be expert in it. Since these concepts are used all most all business logics. Wherver the Java interview happens, interviewer expects you should be 40% of technical skills from Collections framework. So you should be perfect in In this subject. I have collected some of the very important and gunshot questions that have been asked most of the interviews in all major companies. I discussed with many guys who has gone for java interviews and collected these Java Collections Framework Questions & Answers. Just check them out.

What is Spring Framework and its different parts

Spring is a complete j2ee framework having following features 1.      Spring Core: Most basic part of framework that provides IOC and dependency injection features .The most basic part is BeanFactory which provides a sophisticated implementation of the factory pattern which allows programmer to decouple the configuration and specification of dependencies from actual program logic. 2.      Spring Context Package: The package, which provides a way to access objects in a framework-style manner similar to JNDI naming Concept. 3.      Spring DAO package: This Package provides a JDBC-abstraction layer that removes the need to write JDBC coding and parsing database-vendor specific error codes. 4.      Spring ORM package: This Package provides integration layers for popular object-relational mapping. APIs, like JDO, Hibernate etc. Using the ORM package you can use all those O/R-mappers in combination with all the other features Spring offers, such as the simple declarative transaction manage

EJB AND OTHER TECHNOLOGIES

17)What’s the relationship between Enterprise JavaBeans component architecture and CORBA? The Enterprise JavaBeans specification is intended to support compliance with the range of CORBA standards, current and proposed. A Bean’s remote and home interfaces are RMI compliant, and thus can interact with CORBA objects via RMI/IIOP, Sun and IBM’s forthcoming adaptation of RMI that conforms with the CORBA-standard IIOP protocol. As a companion to the Enterprise JavaBeans specification, Sun Microsystems has defined a standard mapping from Enterprise Java Beans API to CORBA IDL. JTA, the transaction API prescribed by the Enterprise JavaBeans specification for bean-managed transactions, is designed to layer easily over the OMG OTS transaction standard. 18)What’s the relationship between Enterprise JavaBeans component architecture and XML technology? The two technologies are complementary: Enterprise JavaBeans defines a standard for portable business logic and XML technology defines a stand

How to Upload a File and How to Store it using Java Program?

A quick and dirty Java Sockets API program:   // imports java.net.Socket, java.io.* void uploadFile(String hostAddr, int port, String fileName) throws FileNotFoundException, IOException { byte[] buf = new byte[1000]; int len = -1; // connect to host at hostAddr, port Socket sock = new Socket(hostAddr, port); FileInputStream in = new FileInputStream(fileName); OutputStream out = sock.getOutputStream(); while ( ( len = in.read(buf) ) != -1 ) { out.write(buf, 0, len); out.flush(); // manually flush output stream for sockets } out.close(); sock.close(); in.close(); } Author: Paul-John A.

Useful RUN Commands

To Access… Run Command Accessibility Controls access.cpl Accessibility Wizard accwiz Add Hardware Wizard hdwwiz.cpl Add/Remove Programs appwiz.cpl Administrative Tools control admintools Adobe Acrobat (if installed) acrobat Adobe Designer (if installed) formdesigner Adobe Distiller (if installed) acrodist Adobe ImageReady (if installed) imageready Adobe Photoshop (if installed) photoshop Automatic Updates wuaucpl.cpl Bluetooth Transfer Wizard fsquirt Calculator calc Certificate Manager certmgr.msc Character Map charmap Check Disk Utility chkdsk Clipboard Viewer clipbrd Command Prompt cmd Component Services dcomcnfg Computer Management compmgmt.msc Control Panel control Date and Time Properties timedate.cpl DDE Shares ddeshare Device Manager devmgmt.msc Direct X Control Panel (if insta

Common Syntax Errors That You May Do in Java Programing

Capitalisation of key words Once we get into the habit of writing class names in capital letters you will occasionally find yourself writing keywords such as class and int with a capital beginning letter. The compiler will object to this and will issue an error message which depends on which keyword was capitalized. The compiler will issue an error message such as: Line nn: class or interface declaration expected when, for example, you capitalize the keyword class . Writing a string over a new line Sometimes you will need to write a long string. A common error is to have a new line embedded in the string. The compiler will object to this and will issue an error message such as: Line nn: ';' expected When this happens the solution is to split the string into two, making sure that neither string has a new line in it, and concatenate them with +. Thus you might replace: