Download presentation
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
Linux OS Windows OS
11
Java is platform indifindent
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 (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
23
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()
25
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
26
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
27
Java Program Q)Can you have multiple classes in a java source file? Ans.)Yes, like the figure given below illustrates:
28
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.
29
A. forgot the String[] args. It is required.
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.
30
Java Programs
31
Java Programs 1) Write a program Java Progam that prints "Hello, World" ten times. 2) ******************** *************** ********** ***** * 3) 1 2 3 4 5
32
Java Programs
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.