INTRODUCTION TO JAVA APPLICATION

24
Introduction Introduction to Java Applications to Java Applications By: By: Ajit Vijayee Yadav Ajit Vijayee Yadav

description

A SMALL BUT USEFULL JAVA APPLICATION

Transcript of INTRODUCTION TO JAVA APPLICATION

Page 1: INTRODUCTION TO JAVA APPLICATION

IntroductionIntroductionto Java Applicationsto Java Applications

By:By:

Ajit Vijayee YadavAjit Vijayee Yadav

Page 2: INTRODUCTION TO JAVA APPLICATION

OBJECTIVES

Introduction History Need for Java The Evolution of Java Characteristics of Java Java Architecture How Java Works Java Architectural Security Sample Program in Java Conclusions Reference

2

Page 3: INTRODUCTION TO JAVA APPLICATION

Introduction to JavaJames Gosling-1995Java is an OOP language that was designed to

meet the need for the platform-independent language. Java is used to create application that can run on a single computer as well as a distributed network. Java is used to develop a stand-alone and Internet-based applications.

The Java programs works on any type of compatible device that supports Java.

Page 4: INTRODUCTION TO JAVA APPLICATION

History of JavaJava programming language was originally

developed by Sun Microsystems, which was initiated by James Gosling and released in 1995 .

As of December 08 the latest release of the Java Standard Edition is 6 (J2SE). 

Sun Microsystems has renamed the new J2 versions as Java SE, Java EE and Java ME respectively. Java is guaranteed to be Write Once, Run Anywhere

Page 5: INTRODUCTION TO JAVA APPLICATION

Needs for Java• Java can be used to write variety of

applicationo Applications that use CUIo Application that use GUIo Appletso Servletso Packages

Page 6: INTRODUCTION TO JAVA APPLICATION

The Evolution of JavaYear Development1990 Sun Microsystems developed software

to manipulate electronic devices.1991 A new language named Oak was

introduced using the most popular object-oriented language C++.

1993 World Wide Web(WWW) appeared on the Internet that transformed the text-based Internet into graphical Internet.

Page 7: INTRODUCTION TO JAVA APPLICATION

1994 The Sun Microsystems team developed a Web browser called HotJava to locate and run applets programs on Internet.

1995 Oak was rename as Java.1996 Java was established as an object-

oriented language.

Page 8: INTRODUCTION TO JAVA APPLICATION

Characteristics of Java Java AppletsJava’s MagicServlets : Java on the server sideOther characteristics of JavaSimpleSecurePortableObject OrientedRobust etc.

Page 9: INTRODUCTION TO JAVA APPLICATION

Java ArchitectureVarious components of Java architecture

are:Java programming language and class fileJVMJava Application Programming Interface (API)

Page 10: INTRODUCTION TO JAVA APPLICATION

The Java Programming Environment

Page 11: INTRODUCTION TO JAVA APPLICATION

How Java WorksJava's platform independence is achieved by

the use of the Java Virtual MachineA Java program consists of one or more files

with a .java extensionThe .class file contains Java bytecode. Bytecode is like machine language, but it is

intended for the Java Virtual Machine not a specific chip such as a Pentium or PowerPC chip

Some people refer to the interpreter as "The Java Virtual Machine" (JVM)

Page 12: INTRODUCTION TO JAVA APPLICATION

Java Architectural Security

The Java architecture also consist of few security features that make Java a secure programming language. The architecture consists of the following security features:

Compiler level securityBytecode verifierClass loaderSandbox model

Page 13: INTRODUCTION TO JAVA APPLICATION

Sample Program in Java1.//Text-printing program.2.3. Public class Welcome4. {5. //main method begins execution of

java application6. Public static void main(String arg[ ])7. {8. System.out.println(“welcome to

Java Programming”); 

Page 14: INTRODUCTION TO JAVA APPLICATION

9. }//end method main10. }//end class WelcomeOutput :Welcome to Java Programming

Page 15: INTRODUCTION TO JAVA APPLICATION

Comments Comments start with: //

Comments ignored during program execution Document and describe code Provides code readability

Traditional comments: /* ... *//* This is a traditional comment. It can be split over many lines */

Another line of commentsNote: line numbers not part of program, added for

reference

Page 16: INTRODUCTION TO JAVA APPLICATION

First Program in Java: Printing a Line of Text (Cont.)

Blank line Makes program more readable Blank lines, spaces, and tabs are white-space characters

Ignored by compiler

Begins class declaration for class Welcome1 Every Java program has at least one user-defined class Keyword: words reserved for use by Java

class keyword followed by class name Naming classes: capitalize every word

SampleClassName

16

3

4 public class Welcome1

Page 17: INTRODUCTION TO JAVA APPLICATION

First Program in Java: Printing a Line of Text (Cont.)

Java identifier Series of characters consisting of letters, digits,

underscores ( _ ) and dollar signs ( $ ) Does not begin with a digit, has no spaces Examples: Welcome1, $value, _value, button7

7button is invalid Java is case sensitive (capitalization matters)

a1 and A1 are different

In chapters 2 to 7, start each class with public class Details of this covered later

17

4 public class Welcome1

Page 18: INTRODUCTION TO JAVA APPLICATION

First Program in Java: Printing a Line of Text (Cont.)

Saving files File name must be class name with .java extension Welcome1.java

Left brace { Begins body of every class Right brace ends declarations (line 13)

18

4 public class Welcome1

5 {

Page 19: INTRODUCTION TO JAVA APPLICATION

First Program in Java: Printing a Line of Text (Cont.)

Part of every Java application Applications begin executing at main

Parentheses indicate main is a method (Ch. 3 and 6) Java applications contain one or more methods

Exactly one method must be called mainMethods can perform tasks and return information

void means main returns no information For now, mimic main's first line

Left brace begins body of method declaration Ended by right brace } (line 11)

19

7 public static void main( String args[] )

8 {

Page 20: INTRODUCTION TO JAVA APPLICATION

First Program in Java: Printing a Line of Text (Cont.)

Instructs computer to perform an action Prints string of characters

String – series of characters inside double quotes White-spaces in strings are not ignored by compiler

System.out Standard output object Print to command window (i.e., MS-DOS prompt)

Method System.out.println Displays line of text

This line known as a statement Statements must end with semicolon ;

20

9 System.out.println( "Welcome to Java Programming!" );

Page 21: INTRODUCTION TO JAVA APPLICATION

First Program in Java: Printing a Line of Text (Cont.)

Ends method declaration

Ends class declarationCan add comments to keep track of ending

braces

21

11 } // end method main

13 } // end class Welcome1

Page 22: INTRODUCTION TO JAVA APPLICATION

First Program in Java: Printing a Line of Text (Cont.)Executing a program

Type java Welcome1 Launches JVM JVM loads .class file for class Welcome1 .class extension omitted from command JVM calls method main

22

Page 23: INTRODUCTION TO JAVA APPLICATION

Conclusion Finally conclusion of this training is

great .which is helping for the basic knowledge about robotics and own analog design .This training is six week .which is good and impressive content in the training to help in my success of Robotics career

Page 24: INTRODUCTION TO JAVA APPLICATION

REFERENCES1.Internet (Wiki.com)2.Teacher and friends3.Books (Reference to Java And PHP )4.NIIT Student Guide