1 / 32

introductory lecture on java programming

introductory lecture on java programming. History of Java. In 1991, “Green Team” of Sun Microsystems leaded by James Gosling developed the Java programming language. First name was Oak (Oak tree) Java is an island of Indonesia where first coffee was produced (called java coffee)

joannreed
Download Presentation

introductory lecture on java programming

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. introductory lecture on java programming

  2. History of Java • In 1991, “Green Team” of Sun Microsystems leaded by James Gosling developed the Java programming language • First name was Oak (Oak tree) • Java is an island of Indonesia where first coffee was produced (called java coffee) • In 1995, JDK Alpha and Beta versions released • JDK 1.0 released in january 23, 1996

  3. Why JAVA ? • Simple • Object-Oriented • Platform independent • Secured • Strong memory management • Portable • Dynamic • High Performance • Multithreaded • Distributed

  4. Where Java is used? • Desktop Applications • Web Applications • Enterprise Applications • Mobile • Embedded System • Smart Card • Robotics • Games etc.

  5. Version • JDK 8 (18th March, 2014) • Most of the cases, we use JDK 7 in our course

  6. Java Technologies • Core Java • Servlet • JSP • Java Frameworks • Junit • Maven

  7. What is Java ? Why Java become famous? • Java is a programming language and a platform. • Platform indifindent

  8. Java is platform indifindent C/C++ Windows OS

  9. Java is platform indifindent C/C++ C/C++ Linux OS Windows OS

  10. Java is platform indifindent JAVA JAVA Linux OS Windows OS

  11. Java is platform indifindent JAVA JAVA JVM for Linux JVM for windows Linux OS Windows OS

  12. Java is platform indifindent • Java program java compiler  bytecode(JVM + Java API) run the program • Java programs run everwhere because java bytecode run on JRE (JVM+API)

  13. Difference between JDK, JRE and JVM JVM • JVM (Java Virtual Machine) is an abstract machine. • Provides runtime environment. The JVM performs following main tasks: • Loads code • Verifies code • Executes code • Provides runtime environment

  14. Difference between JDK, JRE and JVM JRE (Java Runtime Environment) • Provide runtime environment. • It is the implementation of JVM. • It physically exists. • It contains set of libraries + other files that JVM uses at runtime.

  15. Difference between JDK, JRE and JVM JDK (Java Development Kit) • It contains JRE + development tools.

  16. Internal Architecture of JVM

  17. Java Installation • Check Java

  18. How to set path in Java There are 2 ways to set java path: • Temporary • Permanent 1) How to set Temporary Path of JDK in Windows • To set the temporary path of JDK, you need to follow following steps: • write in command prompt: set path=copied_path • For Example: • set path=C:\Program Files\Java\jdk1.6.0_23\bin

  19. How to set path in Java

  20. How to set path in Java • How to set Permanent Path of JDK in Windows • For setting the permanent path of JDK, you need to follow these steps: • Go to MyComputer properties -> advanced tab -> environment variables -> new tab of user variable -> write path in variable name -> write path of bin folder in variable value -> ok -> ok -> ok

  21. How to set path in Java

  22. Java Program • class Hello{   •     public static void main(String args[]){   •      System.out.println("Hello World");   •     }   • }   • Class •  public •  static •  void •  Main •  String[] args •  System.out.println()

  23. Internal Details of Hello Java Program bytecode class Hello{       public static void main(String args[]){        System.out.println("Hello World");       }   }  Compiler Hello.java Hello.class

  24. Java Program Q)Can you save a java source file by other name than the class name? Ans.) Yes, if the class is not public To compile:javac Hard.java To execute:java Simple

  25. Java Program Q)Can you have multiple classes in a java source file? Ans.)Yes, like the figure given below illustrates:

  26. Source file declaration rules • There can be only one public class per source file. • A source file can have multiple non public classes. • The public class name should be the name of the source file as well which should be appended by .java at the end. For example: the class name is public class Employee{} then the source file should be as Employee.java. • If the class is defined inside a package, then the package statement should be the first statement in the source file. • If import statements are present then they must be written between the package statement and the class declaration. If there are no package statements then the import statement should be the first line in the source file. • Import and package statements will imply to all the classes present in the source file. It is not possible to declare different import and/or package statements to different classes in the source file.

  27. Q. What is the meaning of the words public, static and void? Q. Can a program use more than one command-line argument? A. Yes, you can put several, though we normally use only a few. You refer to the second one as args[1], the third one as args[2], and so forth. Note that we start counting from 0 in Java. Q. What exactly is a .class file? A. It's a binary file (sequence of 0s and 1s). Q. What is the wrong ? public class Hello { public static void main() { System.out.println("Doesn't execute"); } } A. forgot the String[] args. It is required.

  28. Java Programs

  29. Java Programs 1) Write a program Java Progam that prints "Hello, World" ten times. 2) ******************** *************** ********** ***** * 3) 1 2 3 4 5

  30. Java Programs

More Related