O slideshow foi denunciado.
Seu SlideShare está sendo baixado. ×

Introduction to java

Anúncio
Anúncio
Anúncio
Anúncio
Anúncio
Anúncio
Anúncio
Anúncio
Anúncio
Anúncio
Anúncio
Anúncio
Próximos SlideShares
Presentation on Core java
Presentation on Core java
Carregando em…3
×

Confira estes a seguir

1 de 31 Anúncio

Mais Conteúdo rRelacionado

Diapositivos para si (20)

Quem viu também gostou (19)

Anúncio

Semelhante a Introduction to java (20)

Mais recentes (20)

Anúncio

Introduction to java

  1. 1. Introduction to Java
  2. 2. • Today Java , is one of the most popular programming language which is used in critical applications like…  web based applications Embedded applications  android mobile application. Introduction
  3. 3. • Lets have a look in history of Java… • Java was developed by James Gosling from Sun Microsystems in 1995. • Introduced as an object-oriented language for general-purpose business applications and for interactive, Web-based Internet applications. • The goal was to provide platform-independent alternative to C++. In other terms it is architecturally neutral, which means that you can use Java to write a program that will run on any platform or device. • Instead, Java runs on a Java Virtual Machine (JVM). History & Evolution
  4. 4. • James Gosling ,Mike Sheridan and Patrick Naughton initiated the green project in June 1991. • Originally designed for small , embedded systems in electronic appliances like set-top boxes. • It was initially called as Oak and later on renamed as “Java” in 1995. • Originally developed by James Gosling at Sun Microsystems in 1995. • JDK 1.0 released in 1996. History and Evolution
  5. 5. History of Java Releases Java Version/Code Name Release Date Important Features/Code Name JDK 1.0 (Oak) 23rd Jan 1996 Initial release JDK 1.1 19th Feb 1997 Reflection , JDBC , Inner Classes ,RMI J2SE 1.2 (Playground) 8th Dec 1998 Collection , JIT, String memory map J2SE 1.3 (Kestrel) 8th May 2000 Java Sound , Java Indexing ,JNDI J2SE 1.4 (Merlin) 6th Feb 2002 Assert , regex, exception chaining J2SE 5.0 (Tiger) 30th Sept 2004 Generics ,autoboxing ,enums Java SE 6.0 (Mustang) 11th Dec 2006 JDBC 4.0 , Java compiler API , Annotations Java SE 7.0 (Dolphin) 28th July 2011 String in switch case ,exception handling new way
  6. 6. Simple: A Java programmer does not need to know the internal functioning of Java, such as how memory is allocated to data. Object-oriented: Java supports the object-oriented approach to develop programs. Compiled and interpreted: The Java programs are first compiled and then interpreted. After the program is compiled, it is converted to a bytecode. The Java Virtual Machine (JVM) then interprets this bytecode into the computer code and runs it. Portable: Refers to the ability of a program to run on any platform without changing the source code of a program. Features of Java Environment
  7. 7. • The following figure shows how the Java bytecode and the JVM together make Java programs portable on different platforms. Features of Java Environment
  8. 8. Distributed: Java is designed for the distributed environment of the Internet because it supports the various Internet protocols, such as Transmission Control Protocols and Internet Protocol (TCP/IP). Secure: Java has built-in security features that verify that the programs do not perform any destructive task, such as accessing the files on a remote system. Features of Java Environment
  9. 9. • Java technology provides language part along with architecture for running applications. • Java Architecture provides • Portable • high-performance • robust runtime environment. • Various Components of Java Architecture are : • Java Programming Language and class file • JVM • Java Application Programming Interface (API) Java Architecture
  10. 10. • Java Runtime Environment contains JVM, class libraries and other supporting components. • Java source code is compiled into bytecode by Java compiler. • This bytecode will be stored in class files. • During runtime, this bytecode will be loaded, verified and JVM interprets the bytecode into machine code which will be executed in the machine in which the Java program runs. Java Runtime Environment (JRE)
  11. 11. • A Java Runtime Environment performs the following main tasks respectively. • Loads the class • This is done by the class loader • Verifies the bytecode • This is done by bytecode verifier. • Interprets the bytecode • This is done by the JVM Java Runtime Environment (JRE)
  12. 12. • Java programming language and class file: • Java programs are saved with an extension, .java. • A .java file is compiled to generate the .class file, which contains the byte code. • The JVM converts the byte code contained in the .class file to machine object code. • The JVM needs to be implemented for each platform running on a different operating system. Java Programming Lang. & Class file
  13. 13. • Its an abstract Machine forms the base of Java Platform. • Specification that provides runtime environment in which java byte code can be executed. • Available for many hardware and software. • JVM performs: • • • • Loads code Verifies code Executes code Provide Runtime Environment Java Virtual Machine (JVM)
  14. 14. • Major Components of JVM • Class Loader • Byte code Verifier • Just In Time (JIT) compiler Java Virtual Machine
  15. 15. Interpreter Byte Code Class Loader Byte code Verifier JIT Compiler Java Runtime Environment Java Virtual Machine Running Program
  16. 16. • Class Loader • Class loader loads all the class files required to execute the program. • Byte code Verifier • • • • Checks that code follows JVM specifications. There is no unauthorized access to memory. The code does not cause any stack overflows. There are no illegal data conversions in the code such as float to object references. Components of JVM
  17. 17. • JIT Compiler • Used to improve performance. • It translates byte code only the first time. • If repeated execution of code is required , it is automatically mapped to the corresponding native machine code. • JIT make use of the machine code which is cached and stored. Components of JVM
  18. 18. Java Development Kit • Package that provides the basic functionality of Java Language. • Contains series of classes and methods • Tools used to develop and execute java programs is known as JDK. • It contains • • • • Basic Tools( javac,java,javap,javadoc,appletviewer etc) RMI tools (rmic,rmiregistry,rmid) Security Tools (keytools,policytool etc.) Java plug-in Tools
  19. 19. Basic Tools Description Javac Compiler for java language Java Launcher of java application Javadoc API documentation generator Appletviewer Run and debug applets without a web browser Jar Manage java archive files Javap Class file dissassembler Java Development Kit
  20. 20. The Java API is a collection of software components that provide capabilities, such as GUI. The related classes and interfaces of the Java API are grouped into packages. The following figure shows how the Java API and the JVM forms the platform for the Java programs on top of the hardware. Java API
  21. 21. • Java can be used to develop more dynamic programs. • Leading programming language for wireless technology and real time embedded programming for cell phones. • Major Categories of java programs : • Applets • Applications Type of Java Programs
  22. 22. • Applets • Small program embedded in a web page. • Applets are downloaded over network and can make network connections only to the host they are issued from. • Graphical in nature and tends to contain controls like text field , button label etc. • Applications • • • • Standalone programs written in java. Invoked by using a JVM. Can access the local file system. Can execute on the server machine. Types of Java Programs
  23. 23. • Temporary Path Setting • Open command prompt • Copy the path of bin folder • Write in command prompt • Set path=c:Program FilesJavaJdk1.6.0_03bin; • Permanent Path Setting • Right click on My Computer • Select Properties > Advanced tab > Environment variables >new tab of user variables > write path in variable name > write path of bin folder in variable value > ok Setting Path for JDK in Windows
  24. 24. Java Program Life Cycle
  25. 25. • Create a source document using any editor such as Notepad and save file as .java • For example: HelloWorld.java • Compile the java file using “javac” command. Byte Code will be generated on disk. Javac HelloWorld.java After Compilation HelloWorld.class • This byte code can run on any platform or device having JVM using “java” Command. StepS are….
  26. 26. class simple { public static void main(String args[]) { System.out.println(“Hello Java”); } } To Compile : javac simple.java To Run : java simple Sample Java Program
  27. 27. • class : Used to declare class in java. • public : Access modifier which represents the visibility. • static : Keyword for creating static method , so that we can access it without creating object. • void : Return type of main method , its doesn’t return anything. • main : Represent the startup of the program • String args[] : Used to store command line arguments. Understanding Sample Program
  28. 28. Source Code Program Compiler Byte code Compilation Process Compilation & Execution
  29. 29. R U N T I M E P R O C E S S Class file Class Loader Byte Code Verifier Interpreter Runtime Compilation & Execution
  30. 30. Output Screen
  31. 31. • Built-in support for multi-threading, socket communication, and memory management (automatic garbage collection). • Object Oriented (OO). • Better portability than other languages across operating systems. • Supports Web based applications (Applet, Servlet, and JSP) . • Supports distributed applications (sockets, RMI, EJB etc.) and network protocols (HTTP, JRMP etc.) with the help of extensive standardized APIs (Application Programming Interfaces). Advantages of Java Programming Language

×