Sie sind auf Seite 1von 7

JAVA

TYPES OF JAVA:
1)J2ME(Java 2 Micro Edition)

2)J2SE(Java 2 Standard Edition)

3)J2EE(Java 2 Enterprise Edition

Difference between C++ & JAVA:


1.JAVA does not include structure and union.

2.JAVA does not support operator ever loading.


3.JAVA does not allow goto statement,size off data type
and data depth.

4.JAVA does not support pointer concept.

5.JAVA does not allow default argument.

6.JAVA does not have a pre-processor.

7.In JAVA there is no hidder file and delete operator.

8.JAVA does not support multiple inheritence but


interface feature support.

9.JAVA is platform independent.

10.JAVA does not allow automatic coversion.

Features of JAVA:
Sun Micro System Company describes Java as a
programming language with the following attributes:

11.Compiled and Interpreted: Java is both


compiled and interpreted language.It has two types
of translaters-compiler & interpreter.Java translate
source code into bytecode instructions,then this Java
bytecode is run on interpreter to execute the
program.

12.Plateform Independent & Portable:


Platform indipendency & portability is the most
important feature of Java language.It means that you
can develop the Java program on any computer
system and the execution of that program is possible
on any other computer system.You do not need to
make any alternations in different operating
system.Java can be run successfully in any
environment.

13.Object Oriented: Java is a true object-oriented


language,which provides a platform to develope an
effective and efficient application and program real
life complexities.Java does not allow methods with
out class.In object-oriented philosphy it is says that
everything is inside class and Java follow this
concept.So Java is a pure object-oriented language.

14.Robust and Secure: Java is widely used for


programming on internet.So security is a major
issue.Java is a strongly typed language.Java provides
checking for two levels - one at the compile time and
the other at the runtime.So programs are highly
reliable.There is no pointer in Java,so the user is not
allowed to gain access to memory location.

15.Multi-threaded: Java is inherently multi-


threaded.A single Java program can have many
different threads executing independently and
continuously.These threads may communicate and
co-operate and will appear to be a single stream to
user.

16.Distributed: Java is a distributed language.It


can be used for creating application that run on
network.It can share both data and program and Java
program can easily access remote object on internet.

17.Dynamic: Java was designed to adapt to an


evolving environment,therefore the Java compiler is
smart and dynamic.Java dynamicaly link new classes
library and method at runtime.This feature gives Java
program a high level of flexibility during program
execution.

Java Architecture:
Bytecode(Intermediate code): Bytecode is a
intermediate code that are produced by Java
compiler.Bytecode is a highly optimized set of instruction
designed to be executed by interpreter or JVM.

JAVA Virtual Machine(JVM)


One of the major features of plateform independency
usually reffered to as"right once run anywhere."This is
accomplished by the JVM that run on the local
machine,interprets Java bytecode and convert it into
plateform specific machine code.JVM perform the
following function:

1)When a class file is executed JVM loades all required


classes automatically from the local disc or from a class
the network.This is the function of "class loader" utility of
JVM.
2)After loading the required classes JVM varify to make
sure that the classes do not violet any of the JAVA
language.This is the function of "bytecode varifier".

3)The JVM keeps track of all memory uses.It take care of


memory allocation and deallocation.This is called
"garbage collection".

JIT (Just In Time) Compiler


Within JVM JIT Compiler are used to improve
performance.JIT compiler translate bytecode only the first
time.If repeated execution of the code is required,it is
automatically mapped to the corresponding native
machine code such as loop are recursive function.

JAVA Development Kit (JDK)


The package that provides the basic functionality of JAVA
language as a series of classes and method.The tools that
are used to develope and execute JAVA program is known
as JAVA Development Kit.These basic tool are
JavaC,Java,JavaDOC,Applet viewer,JAR,JavaH,JavaP.

Types Of JAVA Program


Broadly we can catagorise java program into the following
two main groups:

1)Applet

2)Application.

1)Applet: A java appelet is a small program embeded


in a web page and is run when that page is browsed using
a web browser.Applet can connect to a database on a web
server,communicate with the web server and can play
audio clips,animation and image.

2)Application:Application are stand-alone program


written in Java.They are envoked by using a JVM which
resides within a local operating system.An application
must contain a static method''main( )" where its execution
began.

First Program Of JAVA


class First_Program
{
public static void main(String arg[])
{
System.out.println("hello! this is my first java
program");
}
}
Program1:-
class Sum
{
public static void main(String arg[])
{
int n1=10;
int2=5;
int add=n1+n2;
system.out.println("sum="add);
}
}
sum=15
Program2:-
class Number
{
public static void main(string a[])
{
for(int i=1;i<=10;1++);
{
System.out.println("number="+i);
}
}
}
Program3:-
class Grade
{
public static void main(String arg[])
{
int marks=100;
If (marks>60)
{
System.out.println("grade A");
}
If (marks<60)
{
System.out.println("grade B");
}
If (marks<40)
{

System.out.println("gradeC");
}
{
System.out.println("Fail");
}
}

Das könnte Ihnen auch gefallen