This document provides an outline for a course on Java programming. It covers Java concepts like data types, variables, operators, flow control, decisions, arrays, strings, classes, objects, inheritance, packages, polymorphism, interfaces, AWT, applets, I/O, threads, servlets, and the history and architecture of Java. It explains that Java is a general purpose, platform independent, secure language based on C and C++. It also provides details on writing a first Java program and compiling and running Java code from the command line or an IDE.
2. COURSE OUTLINE
Introduction
Data types & Variable
Operators
Flow control (Loops)
Decisions
Arrays and Strings
Classes and objects(Object Oriented Concept)
Inheritance
Packages and Access Modifiers
Polymorphism
Interfaces
AWT and Applets
IO
Threads
Servlets
3. GENERATIONS
FirstGeneration
Machine Language
Second Generation
Assembly Language
Third Generation
C, Basic, FORTRAN etc
Fourth Generation
C++,JAVA etc
4. HISTORY OF JAVA
The Green Project
1991
Developed by small group of Sun engineers
(Green Team)
Purpose: Intelligent consumer electronic
market
The name JAVA
Launched in 1995
5. INTRODUCTION
Its
a general purpose programming language
Java was based on C, C++ Language
Java is case sensitive
6. STRENGTHS OF JAVA
Simple
Pure Object Oriented
Platform Independent
Secure
Distributed (RMI)
Multi Threaded (Synchronization)
No Memory Constraints (Garbage collection)
10. PROGRAM DEVELOPMENT
Install the JDK along with its documentation
http://www.oracle.com/technetwork/java/javase/downloads/i
ndex.html
Command Line
Edit the source code
Use any editor, windows notepad is a good choice
Source code have extension .java
Compile the Source code
Use javac
Run the program
Use java
Integrated Development Environment (IDE)
KAWA, Eclipse, jCreator, SpringSource, etc
11. FIRST JAVA PROGRAM
// My first program in java
public class MyJava
{
public static void main ( String args [ ] )
{
/* I am inside main . Execution always starts
from method main in java applications*/
System.out.println ( Hello JAVA )
;
}
}
12. FIRST JAVA PROGRAM
Write javac followed by the name of the source
code file(.java)
javac MyJava.java
A file named MyJava.class would be created (byte
code.)
Write java MyJava (without any extension) to
run the class.
Editor's Notes
#4: Machine languages are the only languages understood by computersAn assembly language is a low-level programming language for a computer, microcontroller, or other programmable device, in which each statement corresponds to a single machine code instruction. Each assembly language is specific to a particular computer architecture
#7: One challenge presented to software developers by the increasingly network- centric hardware environment is the wide range of devices that networks interconnect. A typical network usually has many different kinds of attached devices, with diverse hardware architectures, operating systems, and purposes. Java addresses this challenge by enabling the creation of platform-independent programs. A single Java program can run unchanged on a wide range of computers and devices. Compared with programs compiled for a specific hardware and operating system, platform-independent programs written in Java can be easier and cheaper to develop, administer, and maintain. Another challenge the network presents to software developers is security. In addition to their potential for good, networks represent an avenue for malicious programmers to steal or destroy information, steal computing resources, or simply be a nuisance. Virus writers, for example, can place their wares on the network for unsuspecting users to download. Java addresses the security challenge by providing an environment in which programs downloaded across a network can be run with customizable degrees of security. One aspect of security is simple program robustness. Like devious code written by malicious programmers, buggy code written by well-meaning programmers can potentially destroy information, monopolize compute cycles, or cause systems to crash. Java's architecture guarantees a certain level of program robustness by preventing certain types of pernicious bugs, such as memory corruption, from ever occurring in Java programs. This establishes trust that downloaded code will not inadvertently (or intentionally) crash, but it also has an important benefit unrelated to networks: it makes programmers more productive. Because Java prevents many types of bugs from ever occurring, Java programmers need not spend time trying to find and fix them. One opportunity created by an omnipresent network is online software distribution. Java takes advantage of this opportunity by enabling the transmission of binary code in small pieces across networks. This capability can make Java programs easier and cheaper to deliver than programs that are not network- mobile. It can also simplify version control. Because the most recent version of a Java program can be delivered on-demand across a network, you needn't worry about what version your end-users are running. They will always get the most recent version each time they use your program. Mobile code gives rise to another opportunity: mobile objects, the transmission of both code and state across the network. Java realizes the promise of object mobility in its APIs for object serialization and RMI (Remote Method Invocation). Built on top of Java's underlying architecture, object serialization and RMI provide an infrastructure that enables the various components of distributed systems to share objects. The network-mobility of objects makes possible new models for distributed systems programming, effectively bringing the benefits of object-oriented programming to the network. Platform independence, security, and network-mobility--these three facets of Java's architecture work together to make Java suitable for the emerging networked computing environment. Because Java programs are platform independent, network-mobility of code and objects is more practical. The same code can be sent to all the computers and devices the network interconnects. Objects can be exchanged between various components of a distributed system, which can be running on different kinds of hardware. Java's built-in security framework also helps make network-mobility of software more practical. By reducing risk, the security framework helps to build trust in a new paradigm of network-mobile software.
#10: The Java virtual machine (JVM) is a software implementation of a computer that executes programs like a real machine. The Java virtual machine is written specifically for a specific operating system, e.g. for Linux a special implementation is required as well as for Windows. Java programs are compiled by the Java compiler into so-called bytecode. The Java virtual machine interprets this bytecode and executes the Java program.