You are on page 1of 12

JAVA PROGRAMMING

Core Java Advanced Java


 Introduction to JAVA • Applets, AWT
 Language Fundamentals • Swings
o Control Statements • JDBC
o Arrays • HTML
o Functions
• CSS
o Operators
• Java Script
 Object Oriented Programming
o Classes • Servlets
o Objects • Java Server Pages
o Constructors
o Inheritance
o Interfaces
o Polymorphism
 Exception Handling
 Packages
 Multi Threading
 I/O Operations
 Collections

J2SE
When the chronicle of computer languages is written, the following will be
said: B led to C, C evolved into C++, and C++ set the stage for Java.

The C language shook the computer world because it fundamentally changed


the way programming was approached and thought about. The creation of
C was a direct result of the need for a structured, efficient, high-level
language that could replace assembly code when creating systems
programs.

During the late 1970s and early 1980s, C became the dominant computer
programming language, and it is still widely used today.

Java was conceived by James Gosling in 1991. It took 18 months to develop


the first working version. This language was initially called "Oak" but was
renamed "Java" in 1995. the primary motivation was the need for a
platform-independent .
What is JAVA
Java is a high-level, third generation programming language, like
C, Fortran, Smalltalk, Perl, and many others. You can use Java
to write computer applications that crunch numbers, process
words, play games, store data or do any of the thousands of
other things computer software can do.
What's most special about Java in relation to other programming
languages is that it lets you write special programs called
applets that can be downloaded from the Internet and played
safely within a web browser.
Java is a platform for application development. A platform is a
loosely defined computer industry buzzword that typically
means some combination of hardware and system software that
will mostly run all the same software.
A First Simple Program
class Example
{
// Your program begins with a call to main().
public static void main(String args[])
{
System.out.println("This is a simple Java program.");
}
}
The first thing that you must learn about Java is that the
name you give to a source file is very important. For this
example, the name of the source file should be
Example.java.
Compiling the program :
C:\\>javac Example.java
Run the program :
C:\\>java Example
1. Java supports two styles of comments. The one shown at the top of the
program is called a multiline comment. This type of comment must begin with
/* and end with */.
// Your program a call to main().(single line comment)
2. class Example {
This line uses the keyword class to declare that a new class is being defined.
Example is an identifier that is the name of the class.
3. public static void main(String args[]) {
All Java applications begin execution by calling main( ). The public keyword
is an access specifier, which allows the programmer to control the visibility
of class members.
The keyword static allows main( ) to be called without having to instantiate
a particular instance of the class. This is necessary since main( ) is called
by the Java interpreter before any objects are made.
String args[ ] declares a parameter named args, which is an array of
instances of the class String.
In the Java programming language, all source code is first written
in plain text files ending with the .java extension. Those source
files are then compiled into .class files by the javac compiler. A
.class file does not contain code that is native to your
processor; it instead contains bytecodes — the machine
language of the Java Virtual Machine1 (Java VM). The java
launcher tool then runs your application with an instance of the
Java Virtual Machine.
Java is a Platform Independent:
Java was designed to make it much easier to write bug free code.
Java was designed to not only be cross-platform in source form like C,
but also in compiled binary form. Since this is frankly impossible
across processor architectures Java is compiled to an intermediate
form called byte-code.
Byte-code is a highly optimized set of instructions designed to be
executed by the Java run-time system, which is called the Java
Virtual Machine (JVM).
Translating a Java program into byte-code helps makes it much easier
to run a program in a wide variety of environments. The reason is
straightforward: only the JVM needs to be implemented for each
platform. Once the run-time package exists for a given system, any
Java program can run on it.
Java differs from C & C++

Java does not support the struct, union, and pointer data types.
Java does not support typedef or #define.
Java differs in its handling of certain operators and does not
permit operator overloading.
Java does not support multiple inheritance.
Java handles command-line arguments differently than C or C++.
Java has a String class as part of the java.lang package. This
differs from the null-terminated array of characters as used in C
and C++.
Java has an automatic system for allocating and freeing memory
(garbage collection), so it is unnecessary to use memory
allocation and de-allocation functions as in C and C++.
Features of Java
1. Syntax of c and OOPS of c++

2.It is robust

3.When high processing power is used java is


interpreted into native machine code.

4.Java provides securityof not accessing un


authorized code .Prevents local access.

5.JVM acts as a firewall b/w computer and java


pgm that executes over the net
Features Cont…

6. Dynamic linking of java code

7.Distributed environment

8. Multi threading

9. Multi processing.

10.RMI-remote procedure calls.

You might also like