introductory lecture on java programming History of Java

  • Slides: 32
Download presentation
introductory lecture on java programming

introductory lecture on java programming

History of Java In 1991, “Green Team” of Sun Microsystems leaded by James Gosling

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

Why JAVA ? Simple Object-Oriented Platform independent Secured Strong memory management Portable Dynamic High

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

Where Java is used? Desktop Applications Web Applications Enterprise Applications Mobile Embedded System Smart

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

Version JDK 8 (18 th March, 2014) Most of the cases, we use JDK

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

Java Technologies Core Java Servlet JSP Java Frameworks Junit Maven

Java Technologies Core Java Servlet JSP Java Frameworks Junit Maven

What is Java ? Why Java become famous? Java is a programming language and

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

Java is platform indifindent C/C++ Windows OS

Java is platform indifindent C/C++ Windows OS

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

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

Java is platform indifindent JAVA Windows OS JAVA Linux OS

Java is platform indifindent JAVA Windows OS JAVA Linux OS

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

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

Java is platform indifindent Java program java compiler bytecode (JVM + Java API) run

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)

Difference between JDK, JRE and JVM (Java Virtual Machine) is an abstract machine. Provides

Difference between JDK, JRE and 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

Difference between JDK, JRE and JVM JRE (Java Runtime Environment) Provide runtime environment. It

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.

Difference between JDK, JRE and JVM JDK (Java Development Kit) It contains JRE +

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

Internal Architecture of JVM

Internal Architecture of JVM

Java Installation Check Java

Java Installation Check Java

How to set path in Java There are 2 ways to set java path:

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 following steps: write in command prompt: set path=copied_path For Example: set path=C: Program FilesJavajdk 1. 6. 0_23bin

How to set path in Java

How to set path in Java

How to set path in Java How to set Permanent Path of JDK in

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 My. Computer properties -> advanced tab -> environment variables -> new tab of user variable -> write path in variable name -> write path of bin folder in variable value -> ok

How to set path in Java

How to set path in Java

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

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()

Internal Details of Hello Java Program class Hello{ public static void main(String args[]){ System.

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

Java Program Q)Can you save a java source file by other name than the

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

Java Program Q)Can you have multiple classes in a java source file? Ans. )Yes,

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

Source file declaration rules There can be only one public class per source file.

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.

Q. What is the meaning of the words public, static and void? Q. Can

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 0 s and 1 s). 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.

Java Programs

Java Programs

Java Programs 1) Write a program Java Progam that prints "Hello, World" ten times.

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

Java Programs

Java Programs