Sunday, December 21, 2008

Interview Questions

What is a transient variable?

A transient variable is a variable that may not be serialized.

What is a synchronization and why is it important?

With respect to multithreading, synchronization is the capability to control the access of multiple

threads to shared resources. Without synchronization, it is possible for on thread to modify a

shared object while another thread is in the process of using or updating that objective's value.

This often leads to significant errors.

Is null a keyword?

The null value is not a keyword.

What is the vector class?

The vector class provides the capability to implement a growable array of objects.

What modifiers may be used with an inner class that is a member of an outer class?

A (non-local) inner calss may be declared as public, protected, private, static, final, or abstract.

What is an Iterator interface?

The Iterator interface is used to step through the elements of collection.

Can an anonymous class be declared as implementing an interface and extending a class?

An anonymous class may implement an interface or extend a superclass, but may not be declared to do both.

What is the difference between yielding and sleeping?

When a task invokes its yield( ) method, it retruns to the ready state. When a task invokes its sleep( ) method, it returns to the waiting state.

What are wrapped classes?

wrapped classes are classes that allow primitive types to be accessed as objects.

Sunday, December 14, 2008

Monday, December 1, 2008

Introduction to Java

What is Java?
Java is a high-level object-oriented programming language developed by the Sun Microsystems. Though it is associated with the World Wide Web but it is older than the origin of Web. It was only developed keeping in mind the consumer electronics and communication equipments. It came into existence as a part of web application, web services and a platform independent programming language in the 1990s.
Earlier, C++ was widely used to write object oriented programming languages, however, it was not a platform independent and needed to be recompiled for each different CPUs. A team of Sun Microsystems including Patrick Naughton, Mike Sheridan in the guidance of James Goslings decided to develop an advanced programming language for the betterment of consumer electronic devices. They wanted to make it new software based on the power of networks that can run on different application areas, such as computers and electronic devices. In the year 1991 they make platform independent software and named it Oak. But later due to some patent conflicts, it was renamed as Java and in 1995 the Java 1.0 was officially released to the world.

New to Java
If you are new to Java technology and you want to learn Java and make career in the Java technology then this page is for you. Here we have explained how to learn Java and master the Java technologies.
Java is a vast language and it requires a lot of effort to learn and master the necessary Java technology to start your real life projects. we have developed hundreds of tutorials, examples and articles to help you learn Java quickly and easily. We have tried to put support examples related to each Java technology that will help you master the concepts.These tutorials and examples are arranged in a sequence, so that you can learn Java step by step and master the Java and JEE technologies. Basics of Java TechnologyThis section provides an overview of Java technology as programming language and a platform. Java technology is a simple, secure, robust, complete object oriented and platform independent high level programming language. It is also portable, high performance, multithreaded and networksavy that enable it in constructing software that can run along in small machines. The whole technology is based on the concept of
Java Virtual Machine (JVM) that acts as a translators of byte code into machine language. In other words JVM converts the java byte codes into platform specific machine language.
Understanding the Java TechnologyJava technology is high-level, object-oriented, very robust programming language. Java is platform independent programming language and you can run your compiled code on any operating system without recompiling your source code.
Java technology is based on the concept of a single Java virtual machine (JVM) -- a translator between the language and the underlying software and hardware. All implementations of the programming language must emulate the JVM, enabling Java programs to run on any system that has a version of the JVM.
If you want to start java programming then you need to use a text editor to create and edit the source code. By using the Java complier, you can change the source code into byte code. The byte code can be run on any platform having Java interpreter that can convert the byte code into codes suitable for the operating system.
Why Java Technology is so important?
This high-level powerful programming language provides a powerful software platform as the JVM installed on different platform understand the same byte code. This is ideal for server side web programming and runs in a secured manner over internet. It enhance the computing power of the users by taking merely from desktop to the resource of the web. It contains JVM and Java Application Programming Interface (API) that are kinds of readymade software components, and for using any component, the need is just to import a related package in your program use the functionality. It offers development tools that can be used in compiling, running, debugging and documenting the application, making the Java programming fun and easy. The automatic garbage collection mechanism helps in avoiding memory leaks and its coding takes less development time than other programming languages like C++.
Different Editions of Java Technology
a) Java SE - Java SE or Java Standard Edition provides tools and API's that you can use to create server applications, desktop applications, and even applets. These programs developed using Java SE can be run on almost every popular operating system, including Linux, Macintosh, Solaris, and Windows.
b) JEE - Based on the foundation framework of the standard edition, Java Enterprise Edition helps in web application service, component model and enterprise class service oriented architecture (SOA).
c) JME - Java Micro Edition or JME for short is an accumulation of Java APIs that are used for the development of software for devices like mobile phones, PDAs, TV set-top boxes, game programming. The platform of micro edition generally consists of an easy user interface, a robust security model and a wide variety of built-in networks for running Java based application.
Components of each editionJSE ComponentsJavaBeans - It is the component architecture for J2SE platform and one can develop and assemble these software programs for better web application. It is a reusable software component that can be manipulated visually in a builder tool. This software assists visual builder tools in using reflection, introspection, and also analyze and customize JavaBeans.
Java Foundation Classes (JFC) - It is a part of Java class libraries based on the Java platform used for developing graphical user interface (GUI). JFC helps in 2D graphics, imaging, text formatting and printing with the help of Abstract Window Toolkit (AWT), Swing and Java2D. With the help of input method framework, the JFC technology assists in preparing application that can be accessible to all users around the world in different languages. Drag and Drop is another feature of JFC that supports data transfers between different Java applications.
JavaHelp - It is a platform independent and a feature oriented software system that offers developer an automated help component. JavaHelp 2.0 API is useful while building online documentation and presenting online information to the application users.
Java Web Start - It is framework in the Java platform that assists in starting Application software directly from the internet by using a web browser. As we know Java applet can run in a browser but in case of Java Web Start, it doesn't run inside and solve many complex problems associated with Java plugins and JVM. It also provide many classes that in turn provides various services and allow better access to resources. Version 1.0 was introduced in the year 2001. Now with the release of J2SE 1.4, Java Web Start is included with Java Runtime Environment and does need any separate installation.
Java Database Connectivity (JDBC) - JDBC API is a part of Java Standard Edition that helps in accessing data from a SQL based database. Besides, it also process the result and allows in using the programming language with "Write Once, Run Anywhere" feature. Some of its key features are like full access to metadata, no special installation and database identification.
Java Media Framework (JMF) - Its an advanced API that allows Java developers to process and add audio-video source to Java application and applets. It is useful for multimedia developers to capture, playback, transcode different media formats.
JEE - Components:Enterprise JavaBeans (EJB) - This technology is a server side component of Java platform used for the construction of enterprise application. It is one of the Java APIs attached with the enterprise edition. By using Java technology, EJB helps in quick development of small, distributed, transactional and secure application.
JavaMail - This JavaMail API technology allows to build mails and messaging application in a platform independent and protocol independent framework. It is both a part of JSE and JEE platform. Thus, JavaMail uses an extensible platform for transferring all kinds of Multimedia Internet Mail Extension (MIME).
Java Message Service (JMS) - Developed under Java community process, JMS technology is used for sending messages between users. Basically, it is an enterprising messaging tool used for building enterprising application. The JMS API is a combination of Java technology and enterprising messaging that provides facilities for building small message based application. It functions under two models: Point-to-Point and Publishing & Subscribing model. JavaServer Pages (JSP) - The JSP technology enables web developers in developing and maintaining web content pages in formats like HTML and XML. With the help of JSP, it becomes very easy to build server and platform independent web based application. This uses HTML and XML tags that offers logical solution for the content. This separately user interface and content development from each other, which allows the designer to change page layout without changing the content.
Java Servlets - This enables a developer in adding content to a web server by using Java platform. This provides the mechanism for enhancing the functionality of web server. In short, servlets provides platform independent and component based web based application without the performance limiting of CGI program.
JME - Components: Connected Limited Device Configuration (CLDC) - It is one of the configurations of Java Micro Edition. 'Configuration' describes minimal features of a complete Java. The CLDC specifies the capabilities of JVM, the base set of API for resource limited devices like pager and mobile phones. There are two version of CLDC: version 1.0 was released in 2000 and came to be known as Java Specification Request (JSR)30. Later version 1.1 or JSR 139 but 1.0 is more widely used. The Connected Limited Device Configuration and the Mobile Information Device Profile (MIDP) together provides solid Java platform for developing application to run on less processing power devices.
Mobile Information Device Profile (MIDP) - This is another configuration of Java Micro Edition and coupled with CLDC, it provides a farm Java Runtime Environment for various mobile devices and other personal digital assistance (PDA). With the help of MIDP, developers can develop application once and then redistribute them into various mobile information devices in a very small period of time. Its principal functions include the user interface, network connectivity data storage and overall application process management. There are two versions of MIDP: one is MIDP 2.0 or JSR 118 and the second one is the MIDP 1.0 or JSR 37. Connected Device
Configuration (CDC) - Developed under the Java Community Process (JCP), it is a standard framework of Java technology used for building and delivering application that can be shared in a wide range of networks and devices ranging from pagers, mobile phones, set top box and other PDA devices. It is in two versions: the JSR 36 (CDC 1.0) and the latest one is the JSR 218 (CDC 1.1).

Wednesday, November 26, 2008

JAVA History

OOPs and Its Concepts in Java
Brief Introduction to OOP
Object Oriented Programming or OOP is the technique to create programs based on the real world. Unlike procedural programming, here in the OOP programming model programs are organized around objects and data rather than actions and logic. Objects represent some concepts or things and like any other objects in the real Objects in programming language have certain behavior, properties, type, and identity. In OOP based language the principal aim is to find out the objects to manipulate and their relation between each other. OOP offers greater flexibility and compatibility and is popular in developing larger application. Another important work in OOP is to classify objects into different types according to their properties and behavior. So OOP based software application development includes the analysis of the problem, preparing a solution, coding and finally its maintenance.
Java is a object oriented programming and to understand the functionality of OOP in Java, we first need to understand several fundamentals related to objects. These include class, method, inheritance, encapsulation, abstraction, polymorphism etc.
Class - It is the central point of OOP and that contains data and codes with behavior. In Java everything happens within class and it describes a set of objects with common behavior. The class definition describes all the properties, behavior, and identity of objects present within that class. As far as types of classes are concerned, there are predefined classes in languages like C++ and Pascal. But in Java one can define his/her own types with data and code.
Object - Objects are the basic unit of object orientation with behavior, identity. As we mentioned above, these are part of a class but are not the same. An object is expressed by the variable and methods within the objects. Again these variables and methods are distinguished from each other as instant variables, instant methods and class variable and class methods.
Methods - We know that a class can define both attributes and behaviors. Again attributes are defined by variables and behaviors are represented by methods. In other words, methods define the abilities of an object.
Inheritance - This is the mechanism of organizing and structuring software program. Though objects are distinguished from each other by some additional features but there are objects that share certain things common. In object oriented programming classes can inherit some common behavior and state from others. Inheritance in OOP allows to define a general class and later to organize some other classes simply adding some details with the old class definition. This saves work as the special class inherits all the properties of the old general class and as a programmer you only require the new features. This helps in a better data analysis, accurate coding and reduces development time.
Abstraction - The process of abstraction in Java is used to hide certain details and only show the essential features of the object. In other words, it deals with the outside view of an object (interface).
Encapsulation - This is an important programming concept that assists in separating an object's state from its behavior. This helps in hiding an object's data describing its state from any further modification by external component. In Java there are four different terms used for hiding data constructs and these are public, private, protected and package. As we know an object can associated with data with predefined classes and in any application an object can know about the data it needs to know about. So any unnecessary data are not required by an object can be hidden by this process. It can also be termed as information hiding that prohibits outsiders in seeing the inside of an object in which abstraction is implemented.
Polymorphism - It describes the ability of the object in belonging to different types with specific behavior of each type. So by using this, one object can be treated like another and in this way it can create and define multiple level of interface. Here the programmers need not have to know the exact type of object in advance and this is being implemented at runtime.

Comparing XML with HTML

The Main Differences Between XML and HTML:
XML is designed to carry data.
XML describes and focuses on the data while HTML only displays and focuses on how data looks. HTML is all about displaying information but XML is all about describing information. In current scenario XML is the most common tool for data manipulation and data transmission.
XML is used to store data in files and for sharing data between diverse applications. Unlike HTML document where data and display logic are available in the same file, XML hold only data. Different presentation logics could be applied to display the xml data in the required format. XML is the best way to exchange information.
XML is Free and Extensible

XML tags are not predefined. User must "invent" his tags.
The tags used to mark up HTML documents and the structure of HTML documents are predefined. The author of HTML documents can only use tags that are defined in the HTML standard (like
,, etc.).
XML allows the user to define his own tags and document structure.

XML Tags are Case Sensitive

Unlike HTML, XML tags are case sensitive. In HTML the following will work:
(This is incorrect
)
In XML opening and closing tags must therefore be written with the same case:
(This is correct)

XML Elements Must be Properly Nested

Improper nesting of tags makes no sense to XML.

In HTML some elements can be improperly nested within each other like this:
(This text is bold and italic)

In XML all elements must be properly nested within each other like this:
(This text is bold and italic)

XML is a Complement to HTML

XML is not a replacement for HTML.
It is important to understand that XML is not a replacement for HTML. In Web development it is most likely that XML will be used to describe the data, while HTML will be used to format and display the same data.

Introduction to XML

What is XML?
"XML is a cross-platform, software and hardware independent tool for transmitting information"
XML is a W3C Recommendation. It stands for Extensible Markup Language. It is a markup language much like HTML used to describe data. In XML, tags are not predefined. A user defines his own tags and XML document structure like Document Type Definition (DTD), XML Schema to describe the data. Hence it is self-descriptive too. There is Nothing Special About XML It is just plain text with the addition of some XML tags enclosed in angle brackets. In a simple text editor, the XML document is easily visible.
Why Is XML So Important?
There are number of reasons that contributes to the XML’s increasing acceptance, few of them are:
Plain Text
In XML it is easy to create and edit files with anything from a standard text editor to a visual development environment. XML also provides scalability for anything from small configuration files to a company-wide data repository.
Data Identification
The markup tags in XML documents identify the information and break up the data into parts for example... a search program can look for messages sent to particular people from the rest of the message. Different parts of the information are identified and further they can be used in different ways by different applications.
Stylability
When display matters, the style sheet standard, XSL (an advance feature of XML), lets you dictate over the convectional designs (like using HTML) to portray the data. XML being style-free uses different style sheets to produce output in postscript, TEX, PDF, or some new format that hasn't even been invented yet. A user can use a simple XML document to display data in diverse formats like
a plain text file
an XHTML file
a WML (Wireless Markup Language) document suitable for display on a PDA
an Adobe PDF document suitable for hard copy
a VML (Voice Markup Language) dialog for a voicemail information system
an SVG (Scalable Vector Graphic) document that draws pictures of thermometers and water containers
Universally Processed
Apart from being valid, restrictions are imposed on an xml file to abide by a DTD or a Schema to make it well-formed .Otherwise, the XML parser won't be able to read the data. XML is a vendor-neutral standard, so a user can choose among several XML parsers to process XML data.
Hierarchical Approach
XML documents get benefited from their hierarchical structure. Hierarchical document structures are, faster to access. They are also easier to rearrange, because each piece is delimited. This makes xml files easy to modify and maintain.
Inline Reusability
XML documents can be composed of separate entities. XML entities can be included "in line" in a XML document. And this included sections look like a normal part of the document .A user can single-source a section so that an edit to it is reflected everywhere the section is used, and yet a document composed looks like a one-piece document.

How Can You Use XML?
Few Applications of XML
Although there are countless applications that use XML, here are a few examples of the applications that are making use of this technology.
Refined search results - With XML-specific tags, search engines can give users more refined search results. A search engine seeks the term in the tags, rather than the entire document, giving the user more precise results.
EDI Transactions - XML has made electronic data interchange (EDI) transactions accessible to a broader set of users. XML allows data to be exchanged, regardless of the computing systems or accounting applications being used.
Cell Phones - XML data is sent to some cell phones, which is then formatted by the specification of the cell phone software designer to display text, images and even play sounds!
File Converters - Many applications have been written to convert existing documents into the XML standard. An example is a PDF to XML converter.
Voice XML - Converts XML documents into an audio format so that a user can listen to an XML document.
and many more........


XML: An Introduction - Brief History
In the 1970’s, Charles Goldfarb, Ed Mosher and Ray Lorie invented GML at IBM. GML was used to describe a way of marking up technical documents with structural tags. The initials stood for Goldfarb, Mosher and Lorie.
Goldfarb invented the term “mark-up language” to make better use of the initials and it became the Standard Generalized Markup Language.
In 1986, SGML was adopted by the ISO.
SGML is just a specification for defining markup languages.
SGML (Standardized Generalized Markup Language) is the mother of all markup languages like HTML, XML, XHTML, WML etc...
In 1986, SGML became an international standard for defining the markup languages. It was used to create other languages, including HTML, which is very popular for its use on the web. HTML was made by Tim Berners Lee in 1991.
While on one hand SGML is very effective but complex, on the other, HTML is very easy, but limited to a fixed set of tags. This situation raised the need for a language that was as effective as SGML and at the same time as simple as HTML. This gap has now been filled by XML.
The development of XML started in 1996 at Sun Microsystems. Jon Bosak with his team began work on a project for remoulding SGML. They took the best of SGML and produced something to be powerful, but much simpler to use.
The World Wide Web Consortium also contributes to the creation and development of the standard for XML. The specifications for XML were laid down in just 26 pages, compared to the 500+ page specification that define SGML.
 
Learn Unix Hit Counters |Earn More Money