Basics



 Introduction to Java


JAVA is related to C++, which is direct descendent of C. Much of character of JAVA is inherited from these two languages. This language was initially called “Oak” but was renamed as JAVA. The trouble with C and C++ is that they are designed to be compiled for a specific target. Although it is possible to compile a C++ program for just about any type of CPU, to do so requires a full C++ compiler for that CPU. The problem is that compilers are expensive and time consuming to create. The solution of this problem led to the creation of java. Some important features of JAVA:

1)     SIMPLE: JAVA is SIMPLE because in it we don’t use pointers as in C++ and it was designed to be easy professional programmer to learn and use effectively. If one already understands the basic concepts of object oriented programming learning Java will be even easier.
2)     OBJECT-ORIENTED: JAVA is pure OBJECT-ORIENTED because in the |JAVA main within the class. Object Oriented Programming is a way to software that is reusable, extensible and maintable.
3)     PLATFORM INDEPENDENT: JAVA is platform independent. For e.g. C++ programs are designed for specific target. For that we require C++ compiler which are expensive and time consuming to create. But in JAVA programs will also run on another PC because every operating system has Java Virtual Machine.
4)     MULTITHREDED: A single-threaded application has one thread of execution running at all times, all such programmers can do only one task at a time. If a single threaded program need to perform a task that will take several minutes. But JAVA supports multithreaded programming which allows you to write programs that do many things simultaneously. Java synchronized keyword can be used to prevent two threads from entering the same critical block of code at the same time.
5)     SECURITY: When you use a JAVA compatible Web-browser you can safely download Java applets without fear of viral infection by confining a Java program to the JAVA execution environment and not allowing it to access other parts of the computer.
6)     ROBUSTNESS: The ability to create robust programs was given a priority in the design of JAVA .Java is strictly typed language, it checks your code at compile time. It checks code at run time. To better understand how Java is robust, consider two of the reasons for program failure, memory management mistakes and mishandled exception condtions.Memory management can be difficult tedious task in traditional programming environments. For example in C/C++ the programmer must manually allocate and free dynamic memory. This sometimes lead to problems because programmer will either forgot to free memory that has been previously allocated or worse try to free some memory that another part of their code is still using. Java virtually eliminates these problems by managing memory allocation and deallocation .Exceptional conditions in traditional environments often arises in a situation such as division by zero or “file not found”  and they must be managed with clumsy and hard-to-hard construct. Java helps in this area by providing object oriented exception handling. In well written Java programs, all run time errors can be managed by your program.
7)     DISTRIBUTED: Java is designed for the distributed environment of the Internet because it handles TCP/IP protocols.
8)     DYNAMIC: In the windows operating systems, parts of programs can be placed into Dynamic link libraries so that they can be shared and loaded dynamically i.e. when the program is running. The operating system does the final stage of linking at execution time. Using shared DLL (Dynamic Link Library) saves memory and improves the modality of the software. Java takes Dynamic   Libraries a step further. The VM class loaded fetches class files from the network as well from the disk, providing location transparency making java applications distributed as well dynamic.






2.  Java Script       
         
JavaScript is a compact, object-oriented scripting language. It can provide interactive web pages, validate from data, and make your web pages clearer. JavaScript is most well known for its use in Websites. It was originally developed by Brendan Eich of Netscape Communication. It adds functions to HTML pages, which are otherwise static. JavaScript is easier than Java, but not as powerful and deals mainly with elements on the Web page. On the client, JavaScript is maintained as source code embedded into an HTML page. On the server, it is compiled into byte code, similar to java programs.

Features of Java Script:
·        JavaScript was designed to add interactivity to HTML pages.
·        A JavaScript is an interpreted language.
·        JavaScript is usually embedded directly in HTML pages.
·        JavaScript is supported by all major browsers, like Netscape and Internet Explorer.



Functions of Java Script:
 It performs following functions:

·        Control document appearance and content.
·        Read and write client state with cookies.
·        It can manipulate Embedded Images.
·        It can control the browser.
·        Interact with the user.

Limitations of JavaScript:
·        JavaScript does not support networking of any kind.
·        JavaScript does not have any graphic capabilities.
·        Client side JavaScript cannot read or write files.
 

3. Packages

Packages are of the basic components of a Java Program. To avoid the problem that, the name of a class will be unique & not collide with class names chosen by other programs. Java provides a mechanism for partitioning the class name space into more manageable chunks. This mechanism is the package.
 
  We can define classes inside a package that are not accessible by code outside the package. To create a package is quite easy; simply include a package command as the first statement in a Java Source a package command as the first statement in a Java Source File. The package statement defines a name space in which classes are stored. If you omit the package statement, the class names are put into the default package, which has no name.

Packages are mainly of two types:

1.     User Defined
2.     Predefined

Since packages give an easy handle on the entire hierarchy, they will guide to explore the java class hierarchy. The most commonly used predefined packages are:

·        Package java.lang contains the main language support classes.        
     These  with object wrappers, strings, multithreading, and related areas.
·           Package java.util contains language support classes of more utilitarian nature. These include collection and calendar classes, as well as some abstract design codified by the interfaces comparator, iterator and observer.
·           Package java.io provides device-independent file and steam I/O service.
·           Package java.awt hides the bulk of all graphical classes. Because it contains java’s abstract window tool kit (AWT), contained in java.awt and 12 sub packages, the package should really be considered as the heart of the entire hierarchy.
·           Package java.net combines the classes supporting low-level Internet   programming plus pluggable look-and-feel.
·           Package java.applet contains a single class with support for HTML embedded java applets.
·           Package java.swing is required for frame. 


4.      JDBC


JDBC is a Java API for executing SOL statements. It consists of a set of classes and interfaces written in JAVA programming language. JDBC provides a standard API for tool/database developers and makes it possible to write database applications using a pure JAVA API. Basic JDBC interaction in its simplest form can be broken down into four steps:

1.  Open a connection to the database.
2.  Execute a SQL statement.
3.  Process the results.
4.  Close the connection to the database

Using JDBC API, it isn’t necessary to write one program to access a system database, another program to access an Oracle database, another program to access an Informix database and so on. One can write a single program using a JDBC API and the program will be able to send SQL statement to the appropriate database. And with an application returning JAVA programming language, one also doesn’t have to worry about writing different applications to run on different platforms. The combination of JAVA and JDBC lets programmers write it once it anywhere.

                 Microsoft’s ODBC API is probably the most widely used programming interface for accessing relational databases. It offers the ability to connect almost all databases on all platforms. So why not just use ODBC from JAVA?
         
The answer is that you can use ODBC from JAVA, but this is the best done with the help of JDBC in the form of the JDBC-ODBC bridge. The question now becomes,” Why do we need JDBC?” There are several answers to these questions:

1. ODBC is not appropriate for direct use from JAVA because it uses a C interface. Calls from JAVA to native C code have a number of drawbacks in the security, implementations, robustness and automatic portability of applications.
2. A literal transmission of ODBC C API into a JAVA API would not be desirable. For example, JAVA has no pointers and ODBC makes copies use of them, including the notoriously error-prone generic pointer “void”. You can think of JBBC as ODBC translated into an object oriented interface that is natural for JAVA programmers.

3. ODBC is hard to learn. It makes simple and advanced features together and it has complex options even for simple queries. JBBC on the other hand was design to keep simple thing while allowing more advanced capabilities where required.

4. A JAVA API like JDBC is needed in order to enable a “pure JAVA “solution. When ODBC is used, the ODBC driver manager and drivers must be manually installed on every client machine. When the JDBC driver i.e. written completely in JAVA. However JDBC code is automatically installable, portable and secure on all JAVA platforms from network computers to the mainframe.



5. WHAT IS HTML?

HTML (Hyper Text Markup Language): A markup language used to structure text and multimedia documents and to set up hypertext links between documents, used extensively on the World Wide Web. HTML is a markup language that uses a fixed set of markup tags.

·        HTML is a programming language in that an HTML document is a program that, when “run” by a browser, displays its text as Hypermedia.
·        HTML itself is the set of customizable ‘markup” tags that are inserted into HTML document govern its format, multimedia content, and hyperlinks.
·        The HTML is really only a collection of predefined tags which, when inserted into regular text, tell a web browser how to:
1.     Format the document and its text.
2.     Link into other locations, in the same document, in another web page, or even on another server.
3.     Incorporate i.e. insert a graphic image, videos or sound clips into displayed document.

        Features of HTML:

1.     An HTML file can be created using a simple text editor.
2.     HTML file must have an htm or html file extension.
3.     An HTML file is a text file containing small markup tags.
4.     The markup tags tell the browser how to display the page.
5.     HTML is a display only technology.




Comments

Popular posts from this blog

AUDIO SPOTLIGHTING

Electronic Reconnaissance, ELECTRONIC COUNTERMEASURES (ECM), ELECTRONIC COUNTER-COUNTERMEASURES (ECCM)

INTERFACING OF EEPROM with 8051