Java Introduction
We can develop two types of Java programs :-
1.Stand-alone applications
2.Web applets
1.Stand alone applications:- are programs writen in java to carry out certain tasks on a Stand alone local computer.
-> Hot java itself is a Java application program.
->Stand-alone programs can read and write files and perform certain operations that applets cannot do.
->Executing a stand-alone Java programs involves two steps:-
1.Compiling source code into bytecode using javac compiler.
2.Executing the bytecode program using java interpreter.
2.Applets:-are small Java programs develop for Internet application.
->An applet located on a distant computer (server)can be downloaded via internet and executed on a local computer (client) using a java capable browser.
->we can develop applets for doing everything from simple animated graphics to complex games and utilities.
->since applets are embedded in an HTML documents and run inside a web page,creating and running applets and more complex than creating an application.
->An applet can only run within a web browser.
Simple Java program consist
Class sample
{
Public static void main(String args [])
{
System.out.println("Java is better than c++");
}
}
-: Characters of Java :-
1.The smallest units of java language are the characters used to write java tokens.
2.These characters are defined by the unicode character set.
3.The unicode is a 16 -bit character coding system.
3.However,most of us use only the basic ASCII characters, which include letters, digits, and punctuation marks, used in normal English.
-: Features of Java:-
1.Compiled and Interpreted.
2.Platform Independent and Portable.
3.Object oriented.
4.Robust and secure.
5.Distributed.
6.Familier,Simple and small.
7.Multithreaded and Interactive.
8.High performance
9.Dynamic and Extensible.
1.Compiled and Interpreted;-usually a language is compiled and Interpreted.
*Java combines both the approaches.
1)First,java compiler translates the source code into bytecode. Bytecode is intermediate from not the machine instruction.
2)In the second stage,Java interpreter translate this Bytecode to the machine that is running the java program.
2.platform Independent and Portable :-
*Java is platform independent that means changes and upgrades in operating system processors and system resourse will not force any change in Java programs
This is why Java is famous for programmingon Internet which interconnects different kinds of system worldwide.
*Java is portable that means Java programs can be easily moved from one system to another,anywhere, anytime .
*Java ensures portablility in two ways.
1.java compiler generates bytecode instructions that can be implementedon any machine.
2.size of primitive data types are machine dependents.
3.Object oriented:-Java is true object oriented.
*almost everything in java is an object.
*All programs code and data resides within class .
*Java has a lot of class arranged in packages that we can directly use in our programs.
4.Robust and Secure:-java is a robust language.
*here, Robust means , it provides many safeguards to ensure reliable code.
*It has strict compile-time and run time checking for data types.
*Automatic Garbage collected language.
*Security is the major issue, when you work on Internet, Thats why it is not only verify all memory access but also ensure that no viruses are entering through the apllet.
Thats why it doesn't use pointers.
5.Distributed:-java is designed as a distributed for creating application on networks. It has the ability to show both data and programs.
*Java applications can open and access remote objects on internet as they easily do in a local system.
*This enables multiple programmers at multiple remote locations to collaborate and work together on a single project.
6.Simple,small and families:-
*Java is simple and small language.
*Because many features of c&c++ that are either rebundant orvsource of unreliable code are removed.
Example:-Java does not use pointers.
*preprocessor headers file.
*goto statements.
*operator overloading.
*multiple inheritance and many others.
7.Multithreaded and Interactive:-
*Multithreaded means handling multiple tasks simultaneously.
*Java supports multithreading programming.
*example,we can listen an audios while typing or scrolling a page.
*Java comes with tools that supports multiprocess synchronisation and construct smooth running interactive system.
8.High performance :-java performance is high because as it is an interpreted language,mainly due to the use of intermediate bytecode.
*multithreaded enhances the overall execution speed of java programs.
9.Dynamic and Extensible:-capable of dynamically linking in now class libraries, methods and objects.
*Java programs support function written in other languages such as c and c++.
These Functions are known as native methods.
*native methods are linked dynamically at runtime.
0 Comments