Search Techno Talk

Java follows the basic C++ syntax for exception handling. First, you try to execute a block of statements. If an abnormal condition occurs, something will throw an exception that you can catch with a handler.

In addition there may be a block of statements you always want executed- no matter whether an exception occured and no matter whether the exception is handled if it does occur.

Throwing an exception is friendlier than terminating the program because it provides the programmer with the option of writing a handler to deal with the abnormal condition. For example, the following program fragment causes the program to sleep for 10 seconds (10,000 milliseconds) by calling the sleep() class method defined in class Thread of the java.lang package. If sleep is interrupted before the time expires, a message is printed and the execution cotinues with the statement following this try-catch construct:

PrintWriter out = new PrintWriter(System.out, true);
try{
Thread.sleep(10000);
} catch (InterruptedException e){
out.println("Sleeping Interrupted.");
}
//reaches here after try-block finished or exception handled

An exception is an abnormal condition that disrupts normal program flow. There are many cases where abnormal conditions happen during program execution, such as the following:
  1. The file you try to open may not exist.
  2. The class file you want to load may be missing or in the wrong format.
  3. The other end of your network connection may be disrupted for some mysterious reason.
  4. An operand is not in the legal range prescribed for operations or methods.

If these abnormal conditions are not prevented or at least handled properly, either the program will be aborted abruptly or the incorrect results or status will be carried on, causing more and more abnormal conditions. Imagine a program that reads from an unopened file and does computations based on those input values.

The Javac compiler works the same on applets as it does on Java applications:

javac FilledBox.java

Here are a few tips that may help you get started. First, applet classes must always be declared public or they will not get compiled. Also, remember that Java is case-sensitive; Filledbox.java is not the same as FilledBox.java and will not be compiled.

If the Java code is acceptable to the compiler, the only message you will see is about a deprecated API:

Note: FilledBox.java uses a deprecated API. Recompile with "-deprecation" for details. 1 warning.

For now ignore the warning. As long as there were no error messages, the file FilledBox.class will be created. If there were error messages, you need to go back and fix your code. There are many different types of error messages that the compiler may generate when given a source file. The simplest to fix are syntax errors, such as a missing semicolon or closing brace. Other messages will highlight incorrect use of variable types, invalid expressions, or violation access restrictions.

Getting your source code to compile is only the first part of the debugging process; error-free compilation does not guarantee that your program will do what you want.

Creating an HTML file to host your applet

<HTML> <HEAD> <TITLE>Sample HTML Document With Filled Box</TITLE> </HEAD> <BODY> <H1>FilledBox Demo</H1> <P> <APPLET CODE="FilledBox.class" WIDTH=50 HEIGHT=50> <PARAM NAME=color VALUE="red"></APPLET> </BODY> </HTML> You can create this file by simply typing it into a text editor. Save the file as FilledBox.html. HTML files can be named anything you like, although it is common practice to name them after the applets they host.

Java applet source code is written in the same way as Java application source code, with a text editor. The difference is that Java applets do not have a main method. Instead, they have several other methods that are called by the VM when requested by the browser. Here is the source code for the simple FilledBox applet:
import java.awt.*;
import java.applet.Applet;
/**FilledBox displays a filled, colored box in the browser window*/
public class FilledBox extends Applet {
// This variable stores the color specified in the HTML document Color boxColor;
/** Get the box color from the host HTML file*/
public void init() {
String s;
s= getParameter("color");
//The default color is gray
boxColor = Color.gray;
//We expect a parameter called color, which will have
//the value red, white, or blue. If the parameter
//is missing, s will be null
if (s !=null) {
if (s.equals("red")) boxColor=Color.red;
if (s.equals("white")) boxColor=Color.white;
if (s.equals("blue")) boxColor=Color.blue;
}
}
/**Paint the box in region assigned to the applet.
* Use the color specified in the HTML document
*/
public voic paint(Graphics g) {
g.setColor (boxColor);
g.fillRect (0, 0, size().width, size().height);
}
}
A main method is required by all Java applications; it is conspicuously absent in this applet. Java applets do not have any required methods at all. However there are five methods that the VM may call when requested by the Web browser (or appletviewer):

public void init ()
Initializes the applet Called only once.

public void start ()
Called when the browser is ready to start executing the initialized applet. Can be called multiple times if user keeps leaving and returning to the Web page. Also called when browser deiconified.

public void stop ()
Called when the browser wishes to stop executing the applet. Called whenever the user leaves the Web page. Also called when browser iconified.

public void destroy ()
Called when the browser clears the applet out of memory.

public void paint(Graphics g)
Called whenever the browser needs to redraw the applet.

If the applet does not implement any of these methods, the applet will have no functionality for the specific method not implemented. In the example, init and paint are implemented. The init function obtains the desired box color from a parameter in the host document. The paint method draws the filled box in the browser window.
Save this Java applet source as FilledBox.java.

Class Math groups together a typical and quite conservative collection of mathematical functions. The functions provided can be classified as follows:

  • Absolute value, ceiling, floor, min and max functions. These are suitably overloaded so that you can pass in any numeric type without having your arguments automatically cast to different types, thereby possibly losing accuracy.

  • Square root, power, logarithm, and exponential functions. All of these take and return double values only (double, not float, is the default floating point accuracy used by java). You do not need to use casts when passing other numeric types, like int or float, because Java's compiler will automatically convert (compatible) argument types for you. A constant for the natural logarithm base is defined as a double precision value in the constant Math. E.

  • Trigonometric functions (sin, cos, tan, asin, acos, atan). All of these functions work with angles expressed in radians instead of degrees. A full circle in radians is 2*PI radians (as opposed to 360 degrees). Pi is conveniently defined to double precision as the Math class constant Math. PI.

  • A pseudo-random number generator function. One method, random (), is provided as a basis for randomness in applications. Random numbers are very important in simulations, statistical analysis, and, of course, games.

A Java-enabled Web Browser follows a specific series of steps when it encounters an <APPLET> tag in an HTML document.

1. The browser reserves space in the document for displaying the applet. The WIDTH and HEIGHT parameters of the <APPLET> tag determine the amount of space used by the applet.

2. The browser reads the parameters from the <PARAM> tags.

3. The VM starts and is asked to load and initialize the applet. The applet has access to the names and values in the <PARAM> tags.

4. The VM creates a running copy of the applet based on the class file.

5. The browser calls the applet's init method, so the applet will initialize itself.

6. The VM calls the start method of the applet when it is ready for the applet to start processing. It also calls paint to draw the applet in the browser window.

7. Whenever the applet need to be redrawn (for example, when the user scrolls the applet into view), the browser calls the applet's paint method.

8. The browser calls the stop method when the user moves onto another HTML document.

9. The broswer calls the destroy method when it clears the applet out of memory.

HTML files are text files with special character sequences that specify the document formatting characteristics. The special character sequences are called tags, and they consist of symbols places between left and right angle brackets, as shown in the following excerpt: Here is some normal text. < I> Here is some italic text.< / I > The output will be as follows, Here is some normal text. Here is some italic text. Most HTML tags use the < tag > and < / tag > sequences to set and unset their relevant properties. For example, < B>turns on bold, and < / B > turns it off. Other tags, such as the paragraph tags may not require an end tag. A complete HTML file has both formatting and structure tags: < html> < head> < title> Sample HTML Document</title> < /head> < body> < h1>HTML Demo< /h1> This document is a sample of HTML. < /body> < /html> The < H T M L > tag indicates that the file is an H T M L document. The < H E A D > tag marks the start of an invisible header section normally used for recording the title and author of the document. Some programs will only look at the header section of a document. The phrase between the < T I T L E> and < / T I T L E > tags is the name of this document. The body section of the document, marked by the < BODY> tag, contains all the display information; in this case, a level-one heading (signified by < H 1 > and < / H 1 > ) and a line of normal text. To include an image in an HTML file, use the < I M G > tag and specify the name and location of the image you want to load. You can use the full URL of the image; a simpler relative reference can be used if the graphic is located on the same server as the HTML file itself: < html> < head> < title> Sample HTML Document< /title> < head/> < body> < img src="Twinkle.gif" /> < h1>HTML Demo</ h1> This document is a sample of HTML. < /body> </ html> If you want to connect this page to another document via a hypertext link, you must insert an anchor tag (< a>). Everything between the anchor tag and the end anchor tag will be highlighted, so the user knows that the lighlighted test or graphics can be clicked on. The following will build a hypertext link to Techno Talk's group on google in the sample document. < html> < head> < title> Sample HTML Document< /title> < /head> < body> < img src="Twinkle.gif" /> < h1>HTML Demo</ h1> This document is a sample of HTML. < p>Share your expertise< a href=">http://groups.google.com/group/nanonagle-tech">Join Techno Talk Group< /a> </ body> </ html> The paragraph tag (< P > ) makes the test easier to read. A Web browser ignores excess spaces and new lines when displaying a document, so if you need to break a line or begin a new paragraph, you must insert < P > or < B R > tags as necessary.

There is an <APPLET> tag that specifies the location of the class file and the display area allocated to the applet. Suppose you want to add a clock applet that will display the current time in hours, minutes, and seconds. Suppose we have a compiled clock applet called Clock.class. A simple example of an <APPLET> tag that loads the Clock applet:

< APPLET = "Clock.class" width="200" height="60">< / A P P L E T >

When a browser encounters these tagsm it will start the VM and ask it to load Clock.class. It also tells the VM that the applet may draw in a region that is 200 x 60 pixels. The location of the <APPLET> tag in the document determines the coordinate of the top left of the applet's display area.

< html>

< head>

< title> Sample HTML Document< /title>

< /head>

< body>

< img src="Twinkle.gif" />

< h1>HTML Demo</ h1>

This document is a sample of HTML.

< p>

Share your expertise< a href=">http://groups.google.com/group/nanonagle-tech">Join Techno Talk Group< /a>

<P>

< APPLET = "Clock.class" width="200" height="60">< / A P P L E T >

</ body>

</ html>

As you can see, embedding applets into Web pages is simple. Java is able to create plug-in components that can be used by novices as well as experts. For this component strategy to work, the HTML author must be able to customize the properties and behaviour of the applet via HTML. The Java programmer decides which parameters will have meaning for the applet, and the HTML author uses <PARAM> tags to pass initial parameters to the applet. The clock applet needs no parameters, telling the time is a universal function.

As with many other programming languages, java uses a compiler to convert human-readable source code into executable programs. The java compiler generates architecture-independent bytecodes. The bytecodes can be executed only by a Java Virtual Machine (VM), which is an idealized java architecture, usually implemented in software rather than hardware. Java bytecode files are called class files because they contain a single Java class. The vast majority of Java programs will be composed of more than one class file.
To execute Java bytecodes, the VM uses a class loader to fetch the bytecodes from a disk or a network. Each class file is fed to a bytecode verifier that ensures the class is formatted correctly and will not corrupt memory when it is executed. The bytecode verification phase adds to the time it takes to load a class, but it actually allows the program to run faster because the class verification is performed only once, not continuously as the program runs.
The execution unit of the VM carried out the instruction specified in the bytecodes. The simplest execution unit is an interpreter, which is a program that reads the bytecodes, interprets their meaning, and then performs the associated function. Interpreters are generally much slower than native code compilers because they continuously need to look up the meaning of each bytecode during execution.
Fortunately there is an elegant alternative to interpreting code, called Just-in-Time (JIT) compilation. The JIT compilers convert the bytecodes to native code instructions on the user's machine immediately before execution. Traditional native code compilers run on the developer's machine, are used by programmers, and produce non portable executables. JIT compilers run on the user's machine and are transparent to the user; the resulting native code instructions do not need to be ported because they are already at their destination.

1. Use of binary digits (Also visit Logic Gates)
In a normal algebraic expression, a variable can take any numerical value. For example, in the expression 3A+7B=C, we assume that A,B and C may range through the entire field of real numbers.
Since Boolean algebra deals with binary number system, the variables used in the boolean equations may assume only two possible values (0 and 1). If an equation describing logical circuitry has several variables, it is still understood that each of the variables can assume only the values 0 or 1. For example, in the equation A+B=C, each of the variables A,B and C may have only the values 0 or 1.

2. Logical addition
The symbol '+' is used for logical addition operator. It is also known as 'OR' operator. We can define the + symbol (OR operator) by listing all possible values of C in the equation A+B+C. It may be noted that since the variables A and B can have only two possible values (0 or 1) so only four (2 to the power of 2) combinations of inputs are possible. Consider this table

INPUTS OUTPUTS
A + B = C
0 -- 0 -- 0
0 -- 1 -- 1
1 -- 0 -- 1
1 -- 1 -- 1

The resulting output values for each of the four input combinations are given. The above table is called the truth table.

Observe that the result is 0 only when the value of both the input variables is 0. The result is 1 when any of the input variables is 1. Note that a result of 1 is also obtained when both the inputs A and B are 1. This is the reason why the + symbol does not have the 'normal' meaning, but is a logical additonal operator. This concept of logical addition may be executed to any number of variables.

3. Logical multiplication
The symbol '.' is used for logical multiplication operator. It is also known as 'AND' operator. We can again define the symbol (AND operator) by listing all possible combinations of A and B and the resulting value of C in the equation A.B=C. Consider the truth table for this logical operator as follows.

INPUTS OUTPUTS
A . B = C
0 -- 0 -- 0
0 -- 1 -- 0
1 -- 0 -- 0
1 -- 1 -- 1

The equation A.B=C is normally read as "A and B equals C".

4. Complementation
The two operations defined so far (OR and AND) are binary operations because they define an operation on two variables. The complementation operation is a unary operation which is defined on a single variable. The symbol '.' is normally used for complementation operator. It is also known as 'NOT' operator. Thus we write ~A, meaning take the complement of A, and complementation of a variable is the reverse of its value. If A=0 then ~A=1.

5. Operator precedence
Does A+B.C mean (A+B).C or A+(B.C)? The two generate different values for A-1, B=0 and C=0, we have (1+0).0=0 and 1+(0.0)=1, both are different. Hence it is necessary to define operator precedence in order to correctly evaluate Boolean expressions. The precedence of Boolean operators is as follows:
a. The expression is scanned from left to right
b. Expressions enclosed within parebtheses are evaliated first
c. All complement (NOT) operations are performed next
d. All '.' (AND) operations are performed ater that
e. Finally all '+' (OR) operations are performed in the end
So according to this precedence rule, A+B.C means A+(B.C).

Also visit Logic Gates 

We are all familiar with the concept of an index. For example, the directory in a large multi storied building is an index that helps us locate a particular person's room within the building. For instance, to find the room of Dr. Sam within the building, we would look up his name in the directory (index) and read the corresponding floor number and room number. this idea of scanning a logically sequenced table is preferable to searching door by door for a particular name. Indexed sequential files use exactly the same principle. The records in this type of file are organized in a sequence and an index table is used to speed up access to the records without requiring a search of the entire file. The records of the file can be stored in random sequence but the index table is in stored sequence on the key value. This provides the user with a very powerful tool. Not only can the file be processed randomly, but it can also be processed sequentially. Since the index table is in a stored sequence on the key value, the file management system simply accesses the data records in the order of the index values. Thus indexed sequential files provide the user sequential access, even though the file management system is accessing the data records in a physically random order. This technique of file management is randomly referred to as the Indexed Sequential Access Method (ISAM). Files of this type are called ISAM files.

A direct file, also called a random or relative file consists of records organized in such a way that it is possible for the computer to directly locate the key of the desired record without having to search through a sequence of other records. This means that the time required for online enquiry and updating of a few records is much faster than when batch techniques are used. However a direct access storage device, DASD such as a drum, disk, strip file, or mass core is essential for storing a direct file. A record is stored in a direct file by its key field. Although it might be possible to directly use the storage location numbers in DASD as the keys for the records stored in those locations, this is seldom done. Instead, an arithmetic procedure called hashing is frequently used. In this method, an address generating function is used to convert the record key number into DASD storage address. The address generating function is selected in such a manner that the generated address should be distributed uniformly over the entire range of the file area and a unique address should be generated for each record key. However in practice, the above constraints are usually not satisfied and the address generating function often maps a large number of records to the same storage address. Several methods are followed to overcome this problem of collision when it occurs. One approach is to include a pointer field at the location calculated by the hashing function. This field points to the DASD location of another record that has the same calculated address value. When the computer is given the key of a record to be processed at a later date, it reuses the hashing function to locate the stored record. If the record is found at the location calculated by the hashing function, the search is over and the record is directly accessed for processing. On the other hand, if the record at the calculated address does not have the correct key, the computer looks at the pointer field to continue the search. Advantages of direct fields

  1. The access to, and retrieval of a record is quick and direct. Any record can be located and retrieved directly in a fraction of a second without the need for a sequential search of the file
  2. Transactions need not be stored and placed in sequence prior to processing
  3. Accumulation of transactions into batches is not required before processing them. They may be processed as and when generated
  4. It can also provide up-to-the-minute information in response to inquiries from simultaneously usable online stations
  5. If required, it is also possible to process direct file records sequentially in a record key sequence
  6. A direct file organization is most suitable for interactive online applications such as airline or railway reservation systems, teller facility in banking applications, etc.

Disadvantages of direct files

  1. These files must be stored on a direct-access storage device. Hence, relatively expensive hardware and software resources are required
  2. File updation (addition and deletion of records) is more difficult as compared to sequential files
  3. Address generation overhead is involved for accessing each record due to hashing function
  4. May be less efficient in the use of storage space than sequentially organized fields
  5. Special security measures are necessary for online files that are accessible from several stations

In a sequential file records are stored one after another in an ascending or descending order determined by the key field of the records. In payroll example, the records of the employee file may be organized sequentially by employee code sequence.
Sequentially organized files that are processed by computer systems are normally stored on storage media such as magnetic tape, punched paper tape, punched cards or magnetic disks. To access these records, the computer must read the file in sequence from the beginning. The first record is read and processed first, then the second record, in the file sequence, and so on.
To locate a particular record, the computer program must read in each record in sequence and compare its key field to the one that is needed. The retrieval search ends only when the desired key matches with the key field of the currently read record. On an average, about half the file has to be searched to retrieve the desired record from a sequential file.
Advantages of sequential files
  1. Easy to organize, maintain and understand
  2. There is no overhead in address generation. Locating a particular record requires only the specification of the key field
  3. Relatively inexpensive I/O Media and devices can be used for the storage and processing of such files
  4. It is the most efficient and economical file organization in case if applications in which there are large number of file records to be updated at regularly scheduled intervals.

Disadvantages of sequential files

  1. It proves to be very inefficient and uneconomical for applications in which the activity ratio is very low
  2. Since an entire sequential file may need to be read just to retrieve and update few records, accumulation of transactions into batches is required before processing them
  3. Transactions must be stored and placed in sequence prior to processing
  4. Timeliness of data in the file deteriorates while batches are being accumulated
  5. Data redundancy is typically high since the same data may be stored in several files sequenced on different keys

System designers choose to organize, access, and process records and files in different ways depending on the type of application and the needs of users. The three commonly used file organizations used in business data processing applications are - sequential, direct and indexed sequential organizations. The selection of a particular file organization depends upon the type of application. The best organization to use in a given application is the one that happens to meet the user's needs in the most effective and economical manner. In making the choice for an application, designers must evaluate the distinct strengths and weaknesses of each file organization. File organization requires the use of some key field or unique identifying value that is found in every record in the file. The key value must be unique for each record of the file because duplications would cause serious problems. In the payroll example, the employee code field may be used as the key field.

Background processing The automatic execution of lower priority (background) computer programs when higher priority (foreground) programs are not using the system resources. Backup Alternate facilities of programs, data files, hardware equipments, etc., that are used in case the original one is destroyed, lost, or fails to operate. Bandwidth The range of frequencies available for data transmission. The wider the bandwidth of a communications system, the more data it can transmit in a given period of time. Base The total number of digits (symbols) available to represent numbers in a positional number system. BASIC (Beginners All-Purpose Symbolic Instruction Code) An easy-to-learn high-level interactive programming language frequently used with personal computers and in timesharing environments. Batch processing The running of several computer programs one after another without the need of a human operator to run each program individually. This is also known as staked job processing because several jobs are stacked together and processed in groups (batches) for efficient operation. Baud A unit for measuring data transmission speed. It is used to describe the capacity of a carrier. In general usage, baud is identical to bits per second. BCD (Binary Coded Decimal) One of the early coding systems used by computers which is based on the idea of converting each digit of a decimal number into its binary equivalent rather than converting the entire decimal value into a pure binary form. For example, the decimal number 42 is represented by 0100 0010 in 8-4-2-1 BCD notation. Binary A characteristic or property involving a selection, choice, or condition in which there are two possibilities. Binary number system A number system with a base of two. It consists of two digits 0 and 1. Bit Acronym for binary digit, which stands for one binary piece of information. This can be both 0 and 1. Block A group of related items (records, characteristics, etc.) handled as a unit during input and output. A section of program coding treated as a unit. Blocking Factor The number of logical records in a physical record. Boolean algebra An algebra that deals with logical propositions, which are either true or false, and to simplify such propositions. This algebra is suitable for use with binary number system and is very useful in designing logic circuits used by the processors of computer systems. Boolean function A mathematical function in Boolean algebra. For example, w= x+y.z Boolean variable A variable used in Boolean algebra. It can assume a value true or false. Branch statement An instruction that transfers program control to one or more possible paths. Broadband channel The fastest carriers, which have data, transfer rates from 1 million baud (bits per second) or more. These data communication systems handle high volumes of data and are used for high-speed computer-to-computer communication or simultaneous transmission of data to several different devices. Buffer A small storage area used to store information on a temporary bases for compensating the difference in rates of flow of data between various computer devices. For example when data flows from an I/O device to the CPU, it passes through a buffer. Bug An error in a computer program. Bus Circuits that provide a communication path between two or more devices of a digital computer system. For example, the path between a CPU, storage, and peripherals. Byte A fixed number of adjacent bits that represent a particular character of symbol. Normally a byte consists of eight bits.

The purpose of this glossary is to present definitions for some of the terms that are often used in the field of computers and data processing. Abacus The earliest device that qualifies as a digital computer. It permits the user to represent numbers by the position of beads as a rack. Positioning the beads appropriately can carry out simple addition and subtraction rapidly and efficiently. Access time The time interval between the instant at which data is called for from a storage device and the instant delivery begins. Accumulator A local storage area, called a register, in which the result of an arithmetic or logic operation is formed. Acoustic coupler A special type of modern (communications device), which allows an ordinary telephone to be used with a computer device for data transmission. Ada A high level programming language named after Ada Augusta, a friend of Charles Babbage. It is a general purpose programming language developed at the request of the U.S Department of Defense for use in military applications. Adder A logic circuit capable of forming the sum of two or more quantities. Address An identification, represented in the form of a name, label, or number, for designating a particular location in storage area. Address register A local storage register, which contains the address of the next instruction to be executed ALGOL (ALGOrithmic Language) An algebraic, high-level language similar to FORTRAN that is widely used in Europe. Algorithm A sequence of precise and unambiguous instructions for solving a problem in a finite number of operations. Alphanumeric Pertaining to a character set that contains letters, digits and usually other special characters such as the comma, dollar sign, plus sign etc. ALU (Arithmetic Logic Unit) The unit of a computing system, which performs all mathematical and logical operations. It is one of the components of the central processing unit (CPU) of the computer. Analog computer A computer that operates on data, which is in the form of continuously variable physical quantities such as electrical current. ANSI (American National Standards Institute) A U.S based national organization that establishes uniform standards in several fields. APL (A Programming Language) A very powerful high-level language that is well suited for specifying complex algorithms. It is a real-time language usually used in an interpretive and interactive manner and was developed primarily for scientific applications. Application program Software designed for a specific purpose such as pay calculation, processing of examination results, stores accounting and inventory control etc. Architecture The organization and interconnection of the various components of a computer system. Artificial Intelligence A branch of computer science that deals with computers that possess reasoning, learning and thinking capabilities that resemble those of humans. ASCII (American Standard Code for Information interchange) A standard coding system for computers. ASCII-7 is a 7-bit code and its extended version ASCII-8 is an 8-bit code. Assembler A computer program, which translates an assembly language program to its machine language equivalent. Assembly language A low-level programming language in which mnemonics are used to code operations and alphanumeric symbols are used to code operations and alphanumeric symbols are used for addresses. This language lies between high-level language (FORTRAN, COBOL etc.) and machine language (the 1s and 0s the computer understands). Asynchronous communication Communication between units operating independently. Audio response An output medium that produces verbal responses from the computer system. Auxiliary storage A storage that supplements the primary internal storage of a computer. Often referred to as secondary storage, this section of the computer’s memory is characterized by low cost per bit stored, but it generally has an operating speed far slower than that of the primary storage.

Frequently, Java programs use group of characters called strings. A java string is a class, not a primitive data type. The java string is part of the java.lang library, which can be accessed in any java program. However String is a class, it begins with an UPPER CASE letter. Although all data types are with lower case letters. Declare variables: Int a,b,c; Float red=1.22; Int a=5, b=c, d=77; String sname; String nic 010-10125-5128; Boolean flag= true; Boolean choice true; Character grade-;’f’; One ‘f’ in quote is character, but more than one character in a quote is "String". e.g. ‘lkihjdw’; JAVA Contents: Static final double d1=3.14; Static final int fees = 500; JAVA type casting: Int a,b; Double c; C=a+b; The above syntax is wrong because data types are different. C=(double)a+ (double)b; The above statement is correct. We change the data type. Escape sequences: \n-------Line feed. \t--------tab ahead 6 to 8 character on a line. \r-------carriage or return (like Enter key). \b-------backspace. \f------- form feed (printer). \’--------single quote marks

There are two types of libraries: Core library: Core library means JAVA Development Kit (JDK). Optional Library: Optional Libraries means Programmer defined Libraries. The Core Libraries must be present in every implementation of JAVA. JDK version 1.2 has 12 core libraries with a total of 1391 classes. Every library has different classes, and every class has different functions. Core JAVA Libraries in JDK 1.2 are Name: JAVA.Lanugage Class: 93 Description: Basic rushed support for JAVA, Threads reflection and exception Name: JAVA.applet Class: 4 Description: Applet (Web Page) support. Name: JAVA.awt Class: 298 Description: Windows and GUI Buttons, Hex, Bit, etc (Abstract windows tools) Name: JAVA.swing Class: 500 Description: Supports JAVA for GUI development. Name: JAVA.IO Class: 75 Description: Supports input and output. Name: JAVA.util Class: 77 Description: Utility data structure. Name: JAVA.rmi Class: 65 Description: Remote method calls. Name: JAVA.sql Class: 26 Description: Supports database connectivity Name: JAVA.security Class: 106 Description: Supports secure data coding . Name: JAVA.net Class: 38 Description: TCP/IP, IPX/SPX and other network protocols. Name: JAVA.beans Class: 43 Description: Competent software support to remark replied application development by re-use of existing coded fragments. Name: JAVA.text Class: 50 Description: Supports for localized text elements such as date, time and currency. Name: JAVA.math Class: 2 Description: Supports decimal and numeric types in SQL database. Name: JAVAX.accessibility Class: 14 Description: Supports large text size for the visually impaired.

“Program For Inputting 10 Numbers and then Displaying them in Sorted order” /*---> #include #include const int max=10; void sort(int arr[], int size); void swap(int& x, int& y); void main() { clrscr(); int num[10]; cout<<"Enter any 10 numbers:\n"; for (int i=0; i<10;>>num[i]; cout<<"\nThe sorted List is:\n"; sort(num,max); cout<for(i=0; i<10;>getch(); } void sort(int arr[],int size) { int first,last,comp; for (first=0; first{ last=first; for (comp=first+1; compif (arr[comp]last=comp; swap(arr[first],arr[last]); } } void swap(int& x, int& y) { int temp; temp=x; x=y; y=temp; } <-----*\

The OSI, or Open System Interconnection, model defines a networking framework for implementing protocols in seven layers. Control is passed from one layer to the next, starting at the application layer in one station, proceeding to the bottom layer, over the channel to the next station and back up the hierarchy. Application(Layer 7) This layer supports application and end-user processes. Communication partners are identified, quality of service is identified, user authentication and privacy are considered, and any constraints on data syntax are identified. Everything at this layer is application-specific. This layer provides application services for file transfers, e-mail, and other network software services. Telnet and FTP are applications that exist entirely in the application level. Tiered application architectures are part of this layer. Presentation(Layer 6) This layer provides independence from differences in data representation (e.g., encryption) by translating from application to network format, and vice versa. The presentation layer works to transform data into the form that the application layer can accept. This layer formats and encrypts data to be sent across a network, providing freedom from compatibility problems. It is sometimes called the syntax layer. Session(Layer 5) This layer establishes, manages and terminates connections between applications. The session layer sets up, coordinates, and terminates conversations, exchanges, and dialogues between the applications at each end. It deals with session and connection coordination. Transport(Layer 4) This layer provides transparent transfer of data between end systems, or hosts, and is responsible for end-to-end error recovery and flow control. It ensures complete data transfer. Network(Layer 3) This layer provides switching and routing technologies, creating logical paths, known as virtual circuits, for transmitting data from node to node. Routing and forwarding are functions of this layer, as well as addressing, internetworking, error handling, congestion control and packet sequencing. Data Link(Layer 2) At this layer, data packets are encoded and decoded into bits. It furnishes transmission protocol knowledge and management and handles errors in the physical layer, flow control and frame synchronization. The data link layer is divided into two sublayers: The Media Access Control (MAC) layer and the Logical Link Control (LLC) layer. The MAC sublayer controls how a computer on the network gains access to the data and permission to transmit it. The LLC layer controls frame synchronization, flow control and error checking. Physical(Layer 1) This layer conveys the bit stream - electrical impulse, light or radio signal -- through the network at the electrical and mechanical level. It provides the hardware means of sending and receiving data on a carrier, including defining cables, cards and physical aspects. Fast Ethernet, RS232, and ATM are protocols with physical layer components.

A database is a collection of related data and the database management system is the software that manages and controls access to the database. Database is a collection of data (information) on a specific topic stored in an organized manner. In other words, a database is a collection of logically related data, designed to meet the information needs of an organization. Consider example #1: Whenever you visit your local library, there is probably a database containing details of the books in the library, details of the users, reservations and so on. There will be a computerized index, which allows users to find a book based on its title, or its authors or its subject area. The database system will handle reservations to allow a user to reserve a book and to be informed by post when the book is available. The system will also send out reminders to borrowers who have failed to return books on the due date. Typically the system will have a bar code reader, which is used to keep track of books coming in and going out of the library. Consider example #2: When you purchase goods using your credit card, the assistant normally checks that you have sufficient credit left to make the purchase. This check may be carried out by telephone or a card reader linked to a computer system may do it automatically. In either case, there is a database somewhere that contains information about the purchases you have made using your credit card. To check your credit, there is an application program that uses your credit card number to check that the price of the good you wish to buy together with the sum of the purchases you have already made this month is within your credit limit. When the purchase is confirmed, the details of the purchase are added to this database. The application program will also access the database to check that the credit card is not on the list of stolen or lost cards before authorizing the purchase. There will be other application programs to send out monthly statements to each cardholder and to credit accounts when payment is received. Consider example #3: If you are at a University, there will be a database system containing information about yourself, the course you are enrolled in, details about your grant, the modules you have taken in previous years or are taking this year, and details of all your past examination results. There may also be a database containing details related to the next year’s admissions and a database containing details of the staff that work at the university, giving personal details and salary-related details for the payroll office.

JavaScript is the most popular scripting language on the Internet, it works with all major browsers, like Internet Explorer, Google Chrome, Mozilla FireFox, Safari, and Opera. JavaScript is a scripting language, this means, it is a lightweight programming language and everyone can use it without purchasing a license. It is usually embedded directly into HTML pages. It was designed to add interactivity to HTML, and it's scripts execute without preliminary compilation. The amazing this about Java and Javascript is that they are two completely different languages in both concept and design, which some of the newbies do not know. JavaScript is a scripting language with a very simple syntax. Almost anyone can put small "snippets" of code into their HTML pages. A JavaScript can be used to detect the visitor's browser, and - depending on the browser - load another page specifically designed for that browser. It can be used to store and retrieve information on the visitor's computer. JavaScript's official name is ECMAScript. The language was invented by Brendan Eich at Netscape (with Navigator 2.0), and has appeared in all Netscape and Microsoft browsers since 1996. The development of ECMA-262 started in 1996, and the first edition was adopted by the ECMA General Assembly in June 1997. ECMA-262 is the official JavaScript standard, which was approved as an international ISO (ISO/IEC 16262) standard in 1998. The development of the standard is still in progress.

Google Groups
Subscribe to Techno Talk
Email:
Visit this group