Question:
What is basic difference between java n html?
2006-10-04 22:39:43 UTC
What is basic difference between java n html?
Four answers:
2006-10-04 22:44:43 UTC
Java is an object-oriented programming language developed initially by James Gosling and colleagues at Sun Microsystems. The language, initially called Oak (named after the oak trees outside Gosling's office), was intended to replace C++, although the feature set better resembles that of Objective C. Java should not be confused with JavaScript, which shares only the name and a similar C-like syntax. Sun Microsystems currently maintains and updates Java regularly.



Hypertext Markup Language is the authoring software language used on the Internet's World Wide Web. HTML is used for creating World Wide Web pages
joshidarshan_87
2006-10-05 05:57:00 UTC
hello this is darshan,

THERE is a basic difference between java n html is

html==>hyper text markup language is to use creating a web page in which user can make a web page but there is limatation of html. In html user can not store or save data online it can view the designed page



JAVA==>if user made a page using java or java script the data of user who is online can store his/her data on hard drive

so java take two of jobs viewing the page and store the data
jinternazionale
2006-10-05 05:44:30 UTC
html = web browser stuff

java = programming
atul m
2006-10-05 05:53:52 UTC
JAVA



Java Platform, Standard Edition or Java SE (formerly known up to version 5.0 as Java 2 Platform, Standard Edition or J2SE), is a collection of Java programming language APIs useful to many Java platform programs. The Java Platform, Enterprise Edition includes all of the classes in the Java SE, plus a number which are more useful to programs running on servers than on workstations.

Starting with the J2SE 1.4 version (Merlin), the Java SE platform has been developed under the Java Community Process. JSR 59 was the umbrella specification for J2SE 1.4 and JSR 176 specified J2SE 5.0 (Tiger). As of 2006, Java SE 6 (Mustang) is being developed under JSR 270.

The following are descriptions of some of the primary Java SE packages. For a complete list of packages see the J2SE 5.0 API Javadocs.

Contents

[hide]

•1 General purpose packages

o1.1 java.lang

1.1.1 java.lang.ref

1.1.2 java.lang.reflect

1.1.2.1 Discovery

1.1.2.2 Use by name

1.1.2.3 Arrays and proxies

o1.2 java.io

1.2.1 Streams

1.2.2 Random access

1.2.3 File system

o1.3 java.nio

o1.4 java.math

o1.5 java.net

o1.6 java.text

o1.7 java.util

•2 Special purpose packages

o2.1 java.applet

o2.2 java.beans

o2.3 java.awt

o2.4 java.rmi

o2.5 java.security

o2.6 java.sql

o2.7 javax.rmi

o2.8 org.omg.CORBA

o2.9 javax.swing

o2.10 javax.swing.text.html.parser

•3 External links



[edit]

General purpose packages

[edit]

java.lang

The Java package java.lang contains fundamental classes and interfaces closely tied to the language and runtime system. This includes the root classes that form the class hierarchy, types tied to the language definition, basic exceptions, math functions, threading, security functions, as well as some information on the underlying native system.

The main classes in java.lang are:

•Object – the class that is the root of every class hierarchy. (See also Java syntax#Methods in the Object class.)

•Enum – the base class for enumeration classes (as of J2SE 5.0).

•Class – the class that is the root of the Java reflection system.

•Throwable – the class that is the base class of the exception class hierarchy.

•Error, Exception, and RuntimeException – the base classes for each exception type.

•Thread – the class that allows operations on threads.

•String – the class for strings and string literals.

•StringBuffer and StringBuilder – classes for performing string manipulation (StringBuilder as of J2SE 5.0).

•Comparable – the interface that allows generic comparison and ordering of objects (as of J2SE 1.2).

•Iterable – the interface that allows generic iteration using the enhanced for loop (as of J2SE 5.0).

•ClassLoader, Process, Runtime,SecurityManager, and System – classes that provide "system operations" that manage the dynamic loading of classes, creation of external processes, host environment inquiries such as the time of day, and enforcement of security policies.

•Math and StrictMath – classes that provide basic math functions such as sine, cosine, and square root (StrictMath as of J2SE 1.3).

•The primitive wrapper classes that encapsulate primitive types as objects.

•The basic exception classes thrown for language-level and other common exceptions.

Classes in java.lang are automatically imported into every source file.

[edit]

java.lang.ref

The java.lang.ref package provides more flexible types of references than are otherwise available, permitting limited interaction between the application and the Java Virtual Machine (JVM) garbage collector. It is an important package, central enough to the language for the language designers to give it a name that starts with "java.lang", but it is somewhat special-purpose and not used by a lot of developers. This package was added in J2SE 1.2.

Java has a more expressive system of reference than most other garbage-collected programming languages, which allows for special behavior for garbage collection. A normal reference in Java is known as a strong reference. The java.lang.ref package defines three other types of references—soft, weak, and phantom references. Each type of reference is designed for a specific use.

A SoftReference can be used to implement a cache. An object that is not reachable by a strong reference (that is, not strongly reachable), but is referenced by a soft reference is called softly reachable. A softly reachable object may be garbage collected at the discretion of the garbage collector. This generally means that softly reachable objects will only be garbage collected when free memory is low, but again, it is at the discretion of the garbage collector. Semantically, a soft reference means "keep this object unless the memory is needed."

A WeakReference is used to implement weak maps. An object that is not strongly or softly reachable, but is referenced by a weak reference is called weakly reachable. A weakly reachable object will be garbage collected during the next collection cycle. This behavior is used in the class java.util.WeakHashMap. A weak map allows the programmer to put key/value pairs in the map and not worry about the objects taking up memory when the key is no longer reachable anywhere else. Another possible application of weak references is the string intern pool. Semantically, a weak reference means "get rid of this object when nothing else references it."

A PhantomReference is used to reference objects that have been marked for garbage collection but have not yet been finalized. An object that is not strongly, softly or weakly reachable, but is referenced by a phantom reference is called phantom reachable. This allows for more flexible cleanup than is possible with the finalization mechanism alone. Semantically, a phantom reference means "this object is no longer needed and is to be finalized in preparation for being collected."

Each of these reference types extends the Reference class which provides the get() method to return a strong reference to the referent object (or null if the reference has been cleared), and the clear() method to clear the reference.

The java.lang.ref also defines the class ReferenceQueue, which can be used in each of the applications discussed above to keep track of objects that have changed reference type.

[edit]

java.lang.reflect

Reflection is a constituent of the Java API which enables Java code to examine and "reflect" upon Java components at runtime and to use the reflected members. Classes in this package, along with java.lang.Class and java.lang.Package accommodate applications such as debuggers, interpreters, object inspectors, class browsers, and services such as object serialization and JavaBeans that need access to either the public members of a target object (based on its runtime class) or the members declared by a given class. This package was added in JDK 1.1.

Reflection is used to instantiate classes and invoke methods using their names, a concept that allows for dynamic programming. Classes, interfaces, methods, fields, and constructors can all be discovered and used at runtime. Reflection is supported by metadata that the JVM has about the program. There are two basic techniques involved in reflection:

1.Discovery involves taking an object or class and discovering the members, superclasses, implemented interfaces, and then possibly using the discovered elements.

2.Use by name involves starting with the symbolic name of an element and using the named element.

[edit]

Discovery

Discovery typically starts with an object and calling the Object.getClass() method to get the object's Class. The Class object has several methods for discovering the contents of the class, for example:

•getMethods() – returns an array of Method objects representing all the public methods of the class or interface

•getConstructors() – returns an array of Constructor objects representing all the public constructors of the class

•getFields() – returns an array of Field objects representing all the public fields of the class or interface

•getClasses() – returns an array of Class objects representing all the public classes and interfaces that are members (e.g. inner classes) of the class or interface

•getSuperclass() – return the Class object representing the superclass of the class or interface (null is returned for interfaces)

•getInterfaces() – returns an array of Class objects representing all the interfaces that are implemented by the class or interface

[edit]

Use by name

The Class object can be obtained either through discovery, by using the class literal (e.g. MyClass.class) or by using the name of the class (e.g. Class.forName("mypackage.MyClass")). With a Class object, member Method, Constructor, or Field objects can be obtained using the symbolic name of the member. For example:

•getMethod("methodName", Class...) – returns the Method object representing the public method with the name "methodName" of the class or interface that accepts the parameters specified by the Class... parameters.

•getConstructor(Class...) – returns the Constructor object representing the public constructor of the class that accepts the parameters specified by the Class... parameters.

•getField("fieldName") – returns the Field object representing the public field with the name "fieldName" of the class or interface.

Method, Constructor, and Field objects can be used to dynamically access the represented member of the class. For example:

•Field.get(Object) – returns an Object containing the value of the field from the instance of the object passed to get(). (If the Field object represents a static field then the Object parameter is ignored and may be null.)

•Method.invoke(Object, Object...) – returns an Object containing the result of invoking the method for the instance of the first Object parameter passed to invoke(). The remaining Object... parameters are passed to the method. (If the Method object represents a static method then the first Object parameter is ignored and may be null.)

•Constructor.newInstance(Object...) – returns the new Object instance from invoking the constructor. The Object... parameters are passed to the constructor. (Note that the parameterless constructor for a class can also be invoked by calling newInstance().)

[edit]

Arrays and proxies

The java.lang.reflect package also provides an Array class that contains static methods for creating and manipulating array objects, and since J2SE 1.3, a Proxy class that supports dynamic creation of proxy classes that implement specified interfaces.

The implementation of a Proxy class is provided by a supplied object that implements the InvocationHandler interface. The InvocationHandler's []) invoke(Object, Method, Object[]) method is called for each method invoked on the proxy object—the first parameter is the proxy object, the second parameter is the Method object representing the method from the interface implemented by the proxy, and the third parameter is the array of parameters passed to the interface method. The invoke() method returns an Object result that contains the result returned to the code that called the proxy interface method.

[edit]

java.io

The java.io package contains classes that support input and output. The classes in the package are primarily stream-oriented; however, a class for random access files is also provided. The central classes in the package are InputStream and OutputStream which are abstract base classes for reading from and writing to byte streams, respectively. The related classes Reader and Writer are abstract base classes for reading from and writing to character streams, respectively. The package also has a few miscellaneous classes to support interactions with the host file system.

[edit]

Streams

The stream classes follow the decorator pattern by extending the base subclass to add features to the stream classes. Subclasses of the base stream classes are typically named for one of the following attributes:

•the source/destination of the stream data

•the type of data written to/read from the stream

•additional processing or filtering performed on the stream data

The stream subclasses are named using the naming pattern XxxStreamType where Xxx is the name describing the feature and StreamType is one of InputStream, OutputStream, Reader, or Writer.

The following table shows the sources/destinations supported directly by the java.io package:

Source/DestinationNameStream typesIn/OutClasses

byte array (byte[])

ByteArraybytein, outByteArrayInputStream, ByteArrayOutputStream



char array (char[])CharArraycharin, outCharArrayReader, CharArrayWriter



file

Filebyte, charin, outFileInputStream, FileOutputStream, FileReader, FileWriter



string (StringBuffer)

Stringcharin, outStringReader, StringWriter



thread (Thread)

Pipedbyte, charin, outPipedInputStream, PipedOutputStream, PipedReader, PipedWriter



Other standard library packages provide stream implementations for other destinations, such as the InputStream returned by the java.net.Socket.getInputStream() method or the Java EE javax.servlet.ServletOutputStream class.

Data type handling and processing or filtering of stream data is accomplished through stream filters. The filter classes all accept another compatible stream object as a parameter to the constructor and decorate the enclosed stream with addional features. Filters are created by extending one of the base filter classes FilterInputStream, FilterOutputStream, FilterReader, or FilterWriter.

The Reader and Writer classes are really just byte streams with additional processing performed on the data stream to convert the bytes to characters. They use the default character encoding for the platform, which as of J2SE 5.0 is represented by the Charset returned by the java.nio.charset.Charset.defaultCharset() static method. The InputStreamReader class converts an InputStream to a Reader and the OutputStreamWriter class converts an OutputStream to a Writer. Both these classes have constructors that allow the character encoding to use to be specified—if no encoding is specified then the default encoding for the platform is used.

The following table shows the other processes and filters supported directly by the java.io package. All of these classes extend the corresponding Filter class.

OperationNameStream typesIn/OutClasses

buffering

Bufferedbyte, charin, outBufferedInputStream, BufferedOutputStream, BufferedReader, BufferedWriter



"push back" last value readPushbackbyte, charinPushbackInputStream, PushbackReader



read/write primitive types

Databytein, outDataInputStream, DataOutputStream



object serialization (read/write objects)Objectbytein, outObjectInputStream, ObjectOutputStream



[edit]

Random access

The RandomAccessFile class supports random access reading and writing of files. The class uses a file pointer that represents a byte-offset within the file for the next read or write operation. The file pointer is moved implicitly by reading or writing and explicitly by calling the seek(long) or skipBytes(int) methods. The current position of the file pointer is returned by the getFilePointer() method.

[edit]

File system

The File class represents a file or directory path in a file system. File objects support the creation, deletion and renaming of files and directories and the manipulation of file attributes such as read-only and last modified timestamp. File objects that represent directories can be used to get a list of all of the contained files and directories.

The FileDescriptor class is a file descriptor that represents a source or sink (destination) of bytes. Typically this is a file, but can also be a console or network socket. FileDescriptor objects are used to create File streams. They are obtained from File streams and java.net sockets and datagram sockets.

[edit]

java.nio

Main article: New I/O

In J2SE 1.4, the package java.nio (NIO or New I/O) was added to support memory-mapped I/O, facilitating IO operations closer to the underlying hardware with sometimes dramatically better performance. The java.nio package provides support for a number of buffer types. The subpackage java.nio.charset provides support for different character encodings for character data. The subpackage java.nio.channels provides support for channels, which represent connections to entities that are capable of performing I/O operations, such as files and sockets. The java.nio.channels package also provides support for fine-grained locking of files.

[edit]

java.math

The java.math package supports multiprecision arithmetic (including modular arithmetic operations) and provides multiprecision prime number generators used for cryptographic key generation. The main classes of the package are:

•BigDecimal – provides arbitrary-precision signed decimal numbers. BigDecimal gives the user control over rounding behavior through RoundingMode.

•BigInteger – provides arbitrary-precision integers. Operations on BigInteger do not overflow or lose precision. In addition to standard arithmetic operations, it provides modular arithmetic, GCD calculation, primality testing, prime number generation, bit manipulation, and other miscellaneous operations.

•MathContext – encapsulate the context settings which describe certain rules for numerical operators.

•RoundingMode – an enumeration that provides eight rounding behaviors.

[edit]

java.net

The java.net package provides special IO routines for networks, allowing HTTP requests, as well as other common transactions.

[edit]

java.text

The java.text package implements parsing routines for strings and supports various human-readable languages and locale-specific parsing.

[edit]

java.util

Data structures that aggregate objects are the focus of the java.util package. Included in the package is the Collections API, an organized data structure hierarchy influenced heavily by the design patterns considerations.

[edit]

Special purpose packages

[edit]

java.applet

Main article: Java applet

Created to support Java applet creation, the java.applet package allows applications to be downloaded over a network and run within a guarded sandbox. Security restrictions are easily imposed on the sandbox. A developer, for example, may apply a digital signature to an applet, thereby labeling it as safe. Doing so allows the user to grant the applet permission to perform restricted operations (such as accessing the local hard drive), and removes some or all of the sandbox restrictions. Digital certificates are issued by such agencies as Thawte or Entrust.

[edit]

java.beans

Main article: JavaBeans

Included in the java.beans package are various classes for developing and manipulating beans, reusable components defined by the JavaBeans architecture. The architecture provides mechanisms for manipulating properties of components and firing events when those properties change.

Most of the APIs in java.beans are intended for use by a bean editing tool, in which beans can be combined, customized and manipulated. One type of bean editor is a GUI designer in an integrated development environment.

[edit]

java.awt

Main article: Abstract Windowing Toolkit

The Abstract Windowing Toolkit contains routines to support basic GUI operations and uses basic windows from the underlying native system. Many independent implementations of the Java API (such as GNU's libgcj) implement everything but AWT, which is not used by most server-side applications. This package also contains the Java2D graphics API.

[edit]

java.rmi

Main article: Java Remote Method Invocation

The java.rmi package provides Java remote method invocation to support remote procedure calls between two java applications running in different JVMs.

[edit]

java.security

Support for security, including the message digest algorithm, is included in the java.security package.

[edit]

java.sql

Main article: Java Database Connectivity

An implementation of the JDBC API (used to access SQL databases) is grouped into the java.sql package.

[edit]

javax.rmi

Main article: RMI-IIOP

Provides the support for the remote communication between applications, using the RMI over IIOP protocol. This protocol combines RMI and CORBA features.

[edit]

org.omg.CORBA

Main article: CORBA

Provides the support for the remote communication between applications using general inter ORB protocol and supports other features of the common object request broker architecture. Same as RMI and RMI-IIOP, this package is for calling remote methods of objects on other virtual machines (usually via network). From all communication possibilities CORBA is the most portable between various languages. However it is also rather difficult to understand.

[edit]

javax.swing

Main article: Swing (Java)

Swing is a collection of routines that build on java.awt to provide a platform independent widget toolkit. Swing uses the 2D drawing routines to render the user interface components instead of relying on the underlying native operating system GUI support.

Swing is a very rich system in its own right, supporting pluggable looks and feels (PLAFs) so that widgets in the GUI can imitate those from the underlying native system. Design patterns permeate the system, especially a modification of the model-view-controller pattern, which loosens the coupling between function and appearance. One inconsistency is that (as of J2SE 1.3) fonts are drawn by the underlying native system, and not by Java, limiting text portability. Workarounds, such as using bitmap fonts, do exist. In general, layouts are used and keep elements within an aesthetically consistent GUI across platforms.

[edit]

javax.swing.text.html.parser

Provides the error tolerant HTML parser that is used for writing various web browsers and web bots.

[edit]

External links

•Java SE Main page

•J2SE 5.0 API Javadocs

•Java SE API documentation

•JSR 270 (Java SE 6)

•JSR 176 (J2SE 5.0)

•JSR 59 (J2SE 1.4)

•Java software development kits (status as of August 2006):

o1.7 (early development)

o1.6 (beta)

o1.5 (stable, current)

o1.4 (stable)

o1.3 (obsolescent)

o1.2 (no longer actively supported)

Retrieved from "http://en.wikipedia.org/wiki/Java_Platform%2C_Standard_Edition#java.lang"



HTML

HTML has been in use since 1991, but HTML 4.0 (December 1997) was the first standardized version where international characters were given reasonably complete treatment. When an HTML document includes special characters outside the range of seven-bit ASCII two goals are worth considering: the information's integrity, and universal browser display.

Contents

[hide]

•1 The document character encoding

•2 Character references

o2.1 XML character entity references

o2.2 HTML character entity references

•3 See also

•4 External links



[edit]

The document character encoding

When HTML documents are served there are three ways to tell the browser what specific character encoding is to be used for display to the reader. First, HTTP headers can be sent by the web server along with each web page (HTML document). A typical HTTP header looks like this:

Content-Type: text/html; charset=ISO-8859-1

For HTML (not usually XHTML), the other method is for the HTML document to include this information at its top, inside the HEAD element.



XHTML documents have a third option: to express the character encoding in the XML preamble, for example



These methods each advise the receiver that the file being sent uses the character encoding specified. The character encoding is often referred to as the "character set" and it indeed does limit the characters in the raw source text. However, the HTML standard states that the "charset" is to be treated as an encoding of Unicode characters and provides a way to specify characters that the "charset" does not cover. The term code page is also used similarly.

It is a bad idea to send incorrect information about the character encoding used by a document. For example, a server where multiple users may place files created on different machines cannot promise that all the files it sends will conform to the server's specification — some users may have machines with different character sets. For this reason, many servers simply do not send the information at all, thus avoiding making false promises. However, this may result in the equally bad situation where the user agent displays the document incorrectly because neither sending party has specified a character encoding.

The HTTP header specification supersedes all HTML (or XHTML) meta tag specifications, which can be a problem if the header is incorrect and one does not have the access or the knowledge to change them.

Browsers receiving a file with no character encoding information must make a blind assumption. For Western European languages, it is typical and fairly safe to assume windows-1252 (which is similar to ISO-8859-1 but has printable characters in place of some control codes that are forbidden in HTML anyway), but it is also common for browsers to assume the character set native to the machine on which they are running. The consequence of choosing incorrectly is that characters outside the printable ASCII range (32 to 126) usually appear incorrectly. This presents few problems for English-speaking users, but other languages regularly — in some cases, always — require characters outside that range. In CJK environments where there are several different multi-byte encodings in use, auto-detection is often employed.

It is increasingly common for multilingual websites to use one of the Unicode/ISO 10646 transformation formats, as this allows use of the same encoding for all languages. Generally UTF-8 is used rather than UTF-16 or UTF-32 because it is easier to handle in programming languages that assume a byte-oriented ASCII superset encoding, and it is efficient for ASCII-heavy text (which HTML tends to be).

Successful viewing of a page is not necessarily an indication that its encoding is specified correctly. If the page's creator and reader are both assuming some machine-specific character encoding, and the server does not send any identifying information, then the reader will nonetheless see the page as the creator intended, but other readers with different native sets will not see the page as intended.

[edit]

Character references

Main articles: character entity reference and numeric character reference

In addition to native character encodings, characters can also be encoded as character references, which can be numeric character references (decimal or hexadecimal) or character entity references. Character entity references are also sometimes referred to as named entities, or HTML entities for HTML. HTML's usage of character references derives from SGML.

Character entity references have the format &name; where "name" is a case-sensitive alphanumeric string. For example, the character 'λ' can be encoded as λ in an HTML 4 document. Characters <, >, " and & are used to delimit tags, attribute values, and character references. Character entity references <, >, " and &, which are predefined in HTML, XML, and SGML, can be used instead for literal representations of the characters.

Numeric character references can be in decimal format, &#DD;, where DD is a variable-width string of decimal digits. Similarly there is a hexadecimal format, &#HHHH;, where HHHH is a variable-width string of hexadecimal digits, though many consider it good practice to never use fewer than four hex digits, and never use an odd number of hex digits (due to the correspondence of two hex digits to one byte). Unlike named entities, hexadecimal character references are case-insensitive in HTML. For example, λ can also be represented as λ, λ or λ.

Numeric references always refer to Universal Character Set code points, regardless of the page's encoding. Using numeric references that refer to UCS control code ranges is forbidden, with the exception of the linefeed, tab, and carriage return characters. That is, characters in the hexadecimal ranges 00–08, 0B–0C, 0E–1F, 7F, and 80–9F cannot be used in an HTML document, not even by reference —so "™", for example, is not allowed. However, for backward compatibility with early HTML authors and browsers that ignored this restriction, raw characters and numeric character references in the 80–9F range are interpreted by some browsers as representing the characters mapped to bytes 80–9F in the Windows-1252 encoding.

Unnecessary use of HTML character references may significantly reduce HTML readability. If the character encoding for a web page is chosen appropriately then HTML character references are usually only required for a few special characters (or not at all if a native Unicode encoding like UTF-8 is used).

[edit]

XML character entity references

Unlike traditional HTML with its large range of character entity references, in XML there are only five predefined character entity references. These are used to escape characters that are markup sensitive in certain contexts:

•& → & (ampersand, U+0026)

•< → < (left angle bracket, less-than sign, U+003C)

•> → > (right angle bracket, greater-than sign, U+003E)

•" → " (quotation mark, U+0022)

•' → ' (apostrophe, U+0027)

All other character entity references have to be defined before they can be used. For example, use of é (which gives é, Latin small letter E with acute, U+00E9, in HTML) in an XML document will generate an error unless the entity has already been defined. XML also requires that the x in hexadecimal numeric references be in lowercase: for example ਛ rather than ਛ. XHTML, which is an XML application, supports the HTML 4 entity set and XML's ' entity, which does not appear in HTML 4.

However, use of ' in XHTML should generally be avoided for compatibility reasons. ' may be used instead.

[edit]

HTML character entity references

For a list of all HTML character entity references, see List of XML and HTML character entity references (approximately 250 entries).

For a list of all HTML decimal character references, see List of HTML decimal character references (approximately 10,000 entries).


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...