Tuesday, 8 May 2012

Concatenate string using for Loop



/* Write a program to Concatenate  string using for Loop   Example:          Input - 5          Output - 1 2 3 4 5 */


class Join{
      public static void main(String args[]){
      int num = Integer.parseInt(args[0]);

Sunday, 6 May 2012

JavaServer Pages

  Java Server Pages (JSP) 

It is a Java technology that allows software developers to dynamically generate HTML, XML or other types of documents in response to a Web client request. The technology allows Java code and certain pre-defined actions to be embedded into static content.

The JSP syntax adds additional XML-like tags, called JSP actions, to be used to invoke built-in functionality. Additionally, the technology allows for the creation of JSP tag libraries that act as extensions to the standard HTML or XML tags. Tag libraries provide a platform independent way of extending the capabilities of a Web server. JSPs are compiled into Java Servlets by a JSP compiler. A JSP compiler may generate a servlet in Java code that is then compiled by the Java compiler, or it may generate byte code for the servlet directly.
"JavaServer Pages" is a technology released by Sun.

Java Servlet

Java Servlet

The Servlet API, contained in the Java package hierarchy javax.servlet, defines the expected interactions of a web container and a servlet. A web container is essentially the component of a web server that interacts with the servlets. The web container is responsible for managing the lifecycle of servlets, mapping a URL to a particular servlet and ensuring that the URL requester has the correct access rights.

A Servlet is an object that receives requests (ServletRequest) and generates a response (ServletResponse) based on the request. The API package javax.servlet.http defines HTTP subclasses of the generic servlet (HttpServlet) request (HttpServletRequest) and response (HttpServletResponse) as well as an (HttpSession) that tracks multiple requests and responses between the web server and a client. Servlets may be packaged in a WAR file as a Web application.

Moreover, servlets can be generated automatically by JavaServer Pages (JSP), or alternately by template engines such as WebMacro. Often servlets are used in conjunction with JSPs in a pattern called "Model 2", which is a flavor of the model-view-controller pattern.

History
The original servlet specification was created by Sun Microsystems (version 1.0 was finalized in June 1997). Starting with version 2.3, the servlet specification was developed under the Java Community Process. JSR 53 defined both the Servlet 2.3 and JavaServer Page 1.2 specifications. JSR 154 specifies the Servlet 2.4 and 2.5 specifications. As of May 10, 2006, the current version of the servlet specification is 2.5.

In his blog on java.net, Sun veteran and GlassFish lead Jim Driscoll details the history of servlet technology. James Gosling first thought of servlets in the early days of Java, but the concept did not become a product until Sun shipped the Java Web Server product. This was before what is now the Java Platform, Enterprise Edition was made into a specification.

Web containers
A Web container is a computer program that runs Web applications. Web containers are also sometimes called Web engines. Like the other Java APIs, different vendors provide their own implementation. Below is a list of some of the free web containers. (Note that 'free' means that commercial use is free. Some of the commercial containers, e.g. Resin and Orion, make ideal development containers and are also free to use in a server environment for non-profit organizations).

Non-commercial web containers



* Java System Application Server is developed by Sun.
* Apache Tomcat (formerly Jakarta Tomcat) is an open source web container available free of charge under the Apache Software License. It is used in the official reference implementation and has a reputation for being stable.
* Jetty
* Jaminid contains a higher abstraction than servlets.
* Enhydra
* jo!
* Winstone supports specification v2.4, has a focus on minimal configuration and the ability to strip the container down to only what you need.
* tjws spec 2.4, small footprint, modular design

Thursday, 3 May 2012

Flow control and Exception in java


 Flow Control and Exceptions

   Unreachable statements produce a compile-time error.
while (false) { x = 3; } // won't compile
for (;false;) { x =3; } // won't compile
if (false) {x = 3; } // will compile, to provide the ability to conditionally compile the code.
·         Local variables already declared in an enclosing block, therefore visible in a nested block cannot be re-declared inside the nested block.
·         A local variable in a block may be re-declared in another local block, if the blocks are disjoint.
·         Method parameters cannot be re-declared.

1.        Loop constructs

Monday, 30 April 2012

Hardware Basics

1. Which of the following components found on a motherboard is the most visible?

A. Keyboard connector
B. BIOS chip
C. Expansion slots
D. Power connectors


2. Which of the following BEST describes the difference between the "baby" AT and ATX motherboards?

A. The "baby" AT motherboard allows for the installation of more than two full- length expansion cards whereas the ATX motherboard allows for only one or two.
B. The processor, memory, and expansion slots are all in line with each other on a "baby" AT motherboard, whereas the ATX motherboard has the processor and memory slots at right angles to the expansion cards.
C. The ATX motherboard allows for the installation of more than two full-lengthexpansion cards, whereas the "baby" AT allows for only one or two.
D. The "baby" AT motherboard has a 20-pin power connector while the ATX has a12-pin power connector.
(Select two options)


3. Which of the following memory module form factors are commonly used for laptops?

A. Dual Inline Memory Modules (DIMMs)
B. Small Outline DIMMs (SODIMMs)
C. Single Inline Memory Modules (SIMMs)
D. Rambus Inline Memory Modules (RIMMs)


4. Which of the following are SCSI types that allow for 16 devices, including theadapter, to be connected on a single shared cable?

A. Ultra Wide SCSI
B. Fast SCSI
C. Ultra SCSI
D. Fast Wide SCSI
E. Ultra 2 SCSI
(Select two options)

5. What do you call the part of a CD-ROM drive's head assembly that moves acrossthe disk to read it?

A. Read/Write Actuator.
B. The Mechanical Frame.
C. The Head Actuator.
D. The Disk Spindle

6. What is clock speed of the AGPx8 expansion slot?

A. 66 MHz
B. 133 MHz
C. 266 MHz
D. 533 MHz

7. Which of the following components on the motherboard usually house the IDEconnectors?

A. PCI bus
B. North Bridge.
C. ISA bus.
D. South Bridge.

8 When a technician upgrades firmware on a motherboard he has to ______.

A. flash the BIOS
B. replace the CMOS chip
C. replace the BIOS
D. reset the CMOS

9 In which of the following is the output from a power supply rated?

A. Voltage.
B. Watts.
C. Hertz.
D. Ohms

10. When connecting the power cable of an AT power supply to the mother board,which two wires on the power connectors (P8/P9) should be together?

A. The green wires.
B. The white wires.
C. The black wires.
D. The brown wires.