SlideShare a Scribd company logo
PRANVEER SINGH INSTITUTE OF TECHNOLOGY, KANPUR
Core Java Proggramming
Java Language Features
PRANVEER SINGH INSTITUTE OF TECHNOLOGY, KANPUR
Java language was developed by company Sun
Microsystems and creator is James Gosling
JAVA introduction:-
Author James Gosling
Vendor Sun Micro System
Project name Green Project
Type open source & free software
Initial OAK language
Present Name java
Extensions .java & .class & .jar
Initial version jdk 1.0 (java development kit)
Present version java 8
Operating System multi Operating System
Implementation Lang c, cpp……
Symbol coffee cup with saucer
SUN Stanford Universally Network
Slogan/Motto WORA (write once run anywhere)
PRANVEER SINGH INSTITUTE OF TECHNOLOGY, KANPUR
Features of Java Language
• Simplicity
• Object Oriented
• Platform Independent
• Distributed
• Robust & Secure
• Multi-Threaded
• Compiled and Interpreted
PRANVEER SINGH INSTITUTE OF TECHNOLOGY, KANPUR
Compiled & Interpreted…
• Java programs are executed by an interpreter, so
it’s relatively easy to find errors in a program.
• When a running program encounters a problem,
the Java interpreter will display a meaningful
message and , if necessary stop the program.
PRANVEER SINGH INSTITUTE OF TECHNOLOGY, KANPUR
Compiled & Interpreted…
Machine Code
Windows
Interpreter
Macintosh
Interpreter
Machine Code
Windows
Computer
Windows
Computer
Source Code
Java Compiler
Byte code
Implementation of
Java Program
PRANVEER SINGH INSTITUTE OF TECHNOLOGY, KANPUR
Java Architecture…
• The Java Language and run time environment were
designed to facilitate network computing.
• The java design team wanted java to be able to create
flexible and highly reliable programs that could be
distributed across networks and run on virtually any
computing platform. Java stores source code files as ASCII
text files. Java source files are later compiled to Byte -
code file.
PRANVEER SINGH INSTITUTE OF TECHNOLOGY, KANPUR
Bytecode…
• Byte-code is a standardized machine independent,
low level language. The byte code files are loaded
and interpreted at the client’s machine by a special
program called Java Virtual Machine(JVM).
• For Example : An HTML document downloaded to
your machine by a browser might embed a Java
data entry applet. When we activate this applet,
the byte code files are executed by the browser's
JVM.
PRANVEER SINGH INSTITUTE OF TECHNOLOGY, KANPUR
Bytecode…
• When a user runs a Java Program , it is upto the
JVM to load, possibly verify and then execute it.
• The JVM can perform this function from within a
browser or any other container program or directly
on top of the operating system.
PRANVEER SINGH INSTITUTE OF TECHNOLOGY, KANPUR
What actually JVM does...
• It validates the requested byte codes verifying that
they pass various formatting and security checks.
This is a security feature known as
Byte-code-verifier.
• It allocates memory for the incoming Java class
files and guarantees that the security of JVM is not
violated. This is known as class loader.
• It interprets the byte-code instructions found in
the class files to execute the program.
PRANVEER SINGH INSTITUTE OF TECHNOLOGY, KANPUR
Java Development Kit...
• The JDK comes with a collection of tools that are
used for developing and running Java Programs.
• appletviewer (for viewing Java applets)
• javac (Java compiler)
• java (Java Interpreter)
• javap ( Java diassembler)
• javah (for C header files)
• jdb (Java debugger)
PRANVEER SINGH INSTITUTE OF TECHNOLOGY, KANPUR
Installation of Java
1. First Of all you have a .exe file of Jdk1.7(if not then
download from Oracle Site).
2. Now this exe file can be save anywhere (let us consider
D: drive)
3. Open d: drive and double click on jdk1.7 exe file.
4. Press Next button until complete.
5. Now check where java is installed in your machine.
6. If java is successfully installed it means the path where
java is installed should be(default path):
7. C:program File(X86)javajdk1.7
PRANVEER SINGH INSTITUTE OF TECHNOLOGY, KANPUR
• Doble click on the java installation exe file
PRANVEER SINGH INSTITUTE OF TECHNOLOGY, KANPUR
Click Next Button
PRANVEER SINGH INSTITUTE OF TECHNOLOGY, KANPUR
PRANVEER SINGH INSTITUTE OF TECHNOLOGY, KANPUR
First Java Application Program...
import java.lang.*;
class Firstapp
{
public static void main(String args[ ])
{
System.out.println(“This is First Application”);
}
}
PRANVEER SINGH INSTITUTE OF TECHNOLOGY, KANPUR
• Explanation:
• For most computer languages, the name of file
that holds the source code to a program is
arbitrary. However this is not the case with Java.
The first thing you must learn about Java is that
the name you give to a source file should match
the name of the class holds the main() method. So,
in our case name of program is none other than
Firstapp.java. This is because the source file is
officially called a compilation unit. Extension is
also four character long, so your OS must support
long extensions.
First Java Application Program...
PRANVEER SINGH INSTITUTE OF TECHNOLOGY, KANPUR
Explanation:
First statement import java.lang.*;
The purpose of this statement to instruct
interpreter to load language package lang.
Second statement class Firstapp
Declares a class name firstapp so as to place
everything inside this class.
Third statement public static void main(String args[ ])
Defines a method main. This is the starting point for
First Java Application Program...
PRANVEER SINGH INSTITUTE OF TECHNOLOGY, KANPUR
• the interpreter to begin the execution of program.
Here public is an access specifier that declares the
main method as unprotected and therefore making it
accessible to all other classes.
• Next appears the keyword static which declares
this method as one that belongs to the entire class
and not a part of any objects of the class. The main
must always be declared as static since the interpreter
uses this method before any objects are created. The
type modifier void states that main method does not
return any value.
First Java Application Program...
PRANVEER SINGH INSTITUTE OF TECHNOLOGY, KANPUR
• In main(), there is only one parameter String args[ ]
• declared a parameter named args, which is an
array of objects of the class String. Objects of type
String store character strings. args receives any
command-line arguments present when the
program is executed. This program does not make
use of this information.
First Java Application Program...
PRANVEER SINGH INSTITUTE OF TECHNOLOGY, KANPUR
• Fourth statement is
System.out.println(“This is First Application”);
• The println mehtod is a member of the out object,
which is a static data member of System class. This
line prints the string to the screen. The method
println always appends a newline character to the
end of the string. So for the output to be printed
on the same line use print in place of println.
First Java Application Program...
PRANVEER SINGH INSTITUTE OF TECHNOLOGY, KANPUR
• To compile the Java program, execute the compiler, javac,
specifying the name of the source file on command line:
• C:> javac Firstapp.java
• The javac compiler creates a file called
Firstapp.class that contains the bytecode version
of the program. The bytecode is the intermediate
representation of your program that contains
instructions the Java Interpreter will execute. So,
to run your program you use Java interpreter java.
• C:> java Firstapp
First Java Application Program...
PRANVEER SINGH INSTITUTE OF TECHNOLOGY, KANPUR
• When Java source code is compiled each
individual class is put its own output file named
after the class and using the .class extension. This
is why it is important to give source the same
name as the class they contain, so when you
execute your program you are actually executing
the class by the interpreter. It will automatically
search for a file by that name that has the .class
extension. If it finds the file, it will execute the
code contained in the specified class.
First Java Application Program...
PRANVEER SINGH INSTITUTE OF TECHNOLOGY, KANPUR
PRANVEER SINGH INSTITUTE OF TECHNOLOGY, KANPUR
Eclipse IDE(LUNA Version)
1.First Of All you should be download Eclipse
Luna Version and paste Zip format anywhere
(Suppose D: drive )
• Now Extract this zip Folder in same here
like…..
PRANVEER SINGH INSTITUTE OF TECHNOLOGY, KANPUR
• Now DoubleClick on eclipse folder and
search eclipse.exe
• DoubleClick on eclipse icon(.exe)
PRANVEER SINGH INSTITUTE OF TECHNOLOGY, KANPUR
• Select the workspace
PRANVEER SINGH INSTITUTE OF TECHNOLOGY, KANPUR
PRANVEER SINGH INSTITUTE OF TECHNOLOGY, KANPUR
• Now How to java Program run
• Go to File->Java Project
PRANVEER SINGH INSTITUTE OF TECHNOLOGY, KANPUR
• Now provide the name of Project
PRANVEER SINGH INSTITUTE OF TECHNOLOGY, KANPUR
• Click Next Button
PRANVEER SINGH INSTITUTE OF TECHNOLOGY, KANPUR
• Now click on finish button
• See the project Test of Left Pane and Expand
this
PRANVEER SINGH INSTITUTE OF TECHNOLOGY, KANPUR
• Now right click on “src” folder select New-
>Class
PRANVEER SINGH INSTITUTE OF TECHNOLOGY, KANPUR
• Provide the class name we provide “Hello”
PRANVEER SINGH INSTITUTE OF TECHNOLOGY, KANPUR
• Write the code on Hello Class File Like
PRANVEER SINGH INSTITUTE OF TECHNOLOGY, KANPUR
• Now right Click On Hello.java select RunAs-
>Java Application
PRANVEER SINGH INSTITUTE OF TECHNOLOGY, KANPUR

More Related Content

PPTX
Introduction to java
PDF
Introduction java programming
PPTX
1_Introduction to Java.pptx java programming
PPTX
LLLecture-JAVAPROGRAMMINGBasics1.KI.pptx
PPTX
Object Oriented Programming Part 1 of Unit 1
PPT
j-chap1-Basics.ppt
PPTX
Java fundamentals
PDF
JAVA BOOK BY SIVASANKARI
Introduction to java
Introduction java programming
1_Introduction to Java.pptx java programming
LLLecture-JAVAPROGRAMMINGBasics1.KI.pptx
Object Oriented Programming Part 1 of Unit 1
j-chap1-Basics.ppt
Java fundamentals
JAVA BOOK BY SIVASANKARI

Similar to Lecture1_Introduction.ppt (20)

PPTX
Mpl 1
PDF
JAVA for Every one
PPTX
Programming in Java
PPTX
Java chapter 1 basic introduction Unit-1.pptx
PPTX
Programming in java ppt
PPTX
Programming in java ppt
PPTX
PPTX
Java basics
PPTX
Skillwise Elementary Java Programming
PPTX
Core java introduction
PPT
Java basics
PPTX
01. Introduction to programming with java
PPTX
UNIT 1.pptx
PPTX
Lecture-2.pptx sensor design and signal processing using RF and THz sensing, ...
PDF
What is java
PPSX
Java Semimar Slide (Cetpa)
PPSX
Java Semimar Slide (Cetpa)
PPTX
2 22CA026_Advance Java Programming_Data types and Operators.pptx
PDF
J introtojava1-pdf
PPTX
java basics.pptx
Mpl 1
JAVA for Every one
Programming in Java
Java chapter 1 basic introduction Unit-1.pptx
Programming in java ppt
Programming in java ppt
Java basics
Skillwise Elementary Java Programming
Core java introduction
Java basics
01. Introduction to programming with java
UNIT 1.pptx
Lecture-2.pptx sensor design and signal processing using RF and THz sensing, ...
What is java
Java Semimar Slide (Cetpa)
Java Semimar Slide (Cetpa)
2 22CA026_Advance Java Programming_Data types and Operators.pptx
J introtojava1-pdf
java basics.pptx
Ad

Recently uploaded (20)

PDF
Embodied AI: Ushering in the Next Era of Intelligent Systems
PDF
TFEC-4-2020-Design-Guide-for-Timber-Roof-Trusses.pdf
DOCX
573137875-Attendance-Management-System-original
PDF
Enhancing Cyber Defense Against Zero-Day Attacks using Ensemble Neural Networks
PDF
Model Code of Practice - Construction Work - 21102022 .pdf
PDF
Mitigating Risks through Effective Management for Enhancing Organizational Pe...
PPTX
FINAL REVIEW FOR COPD DIANOSIS FOR PULMONARY DISEASE.pptx
PPT
Project quality management in manufacturing
PPTX
UNIT-1 - COAL BASED THERMAL POWER PLANTS
PPTX
Foundation to blockchain - A guide to Blockchain Tech
PPTX
bas. eng. economics group 4 presentation 1.pptx
PDF
PRIZ Academy - 9 Windows Thinking Where to Invest Today to Win Tomorrow.pdf
PPTX
UNIT 4 Total Quality Management .pptx
PPTX
Geodesy 1.pptx...............................................
PPTX
CYBER-CRIMES AND SECURITY A guide to understanding
PPT
Mechanical Engineering MATERIALS Selection
PDF
Digital Logic Computer Design lecture notes
PDF
Well-logging-methods_new................
PDF
composite construction of structures.pdf
PPTX
OOP with Java - Java Introduction (Basics)
Embodied AI: Ushering in the Next Era of Intelligent Systems
TFEC-4-2020-Design-Guide-for-Timber-Roof-Trusses.pdf
573137875-Attendance-Management-System-original
Enhancing Cyber Defense Against Zero-Day Attacks using Ensemble Neural Networks
Model Code of Practice - Construction Work - 21102022 .pdf
Mitigating Risks through Effective Management for Enhancing Organizational Pe...
FINAL REVIEW FOR COPD DIANOSIS FOR PULMONARY DISEASE.pptx
Project quality management in manufacturing
UNIT-1 - COAL BASED THERMAL POWER PLANTS
Foundation to blockchain - A guide to Blockchain Tech
bas. eng. economics group 4 presentation 1.pptx
PRIZ Academy - 9 Windows Thinking Where to Invest Today to Win Tomorrow.pdf
UNIT 4 Total Quality Management .pptx
Geodesy 1.pptx...............................................
CYBER-CRIMES AND SECURITY A guide to understanding
Mechanical Engineering MATERIALS Selection
Digital Logic Computer Design lecture notes
Well-logging-methods_new................
composite construction of structures.pdf
OOP with Java - Java Introduction (Basics)
Ad

Lecture1_Introduction.ppt

  • 1. PRANVEER SINGH INSTITUTE OF TECHNOLOGY, KANPUR Core Java Proggramming Java Language Features
  • 2. PRANVEER SINGH INSTITUTE OF TECHNOLOGY, KANPUR Java language was developed by company Sun Microsystems and creator is James Gosling
  • 3. JAVA introduction:- Author James Gosling Vendor Sun Micro System Project name Green Project Type open source & free software Initial OAK language Present Name java Extensions .java & .class & .jar Initial version jdk 1.0 (java development kit) Present version java 8 Operating System multi Operating System Implementation Lang c, cpp…… Symbol coffee cup with saucer SUN Stanford Universally Network Slogan/Motto WORA (write once run anywhere) PRANVEER SINGH INSTITUTE OF TECHNOLOGY, KANPUR
  • 4. Features of Java Language • Simplicity • Object Oriented • Platform Independent • Distributed • Robust & Secure • Multi-Threaded • Compiled and Interpreted PRANVEER SINGH INSTITUTE OF TECHNOLOGY, KANPUR
  • 5. Compiled & Interpreted… • Java programs are executed by an interpreter, so it’s relatively easy to find errors in a program. • When a running program encounters a problem, the Java interpreter will display a meaningful message and , if necessary stop the program. PRANVEER SINGH INSTITUTE OF TECHNOLOGY, KANPUR
  • 6. Compiled & Interpreted… Machine Code Windows Interpreter Macintosh Interpreter Machine Code Windows Computer Windows Computer Source Code Java Compiler Byte code Implementation of Java Program PRANVEER SINGH INSTITUTE OF TECHNOLOGY, KANPUR
  • 7. Java Architecture… • The Java Language and run time environment were designed to facilitate network computing. • The java design team wanted java to be able to create flexible and highly reliable programs that could be distributed across networks and run on virtually any computing platform. Java stores source code files as ASCII text files. Java source files are later compiled to Byte - code file. PRANVEER SINGH INSTITUTE OF TECHNOLOGY, KANPUR
  • 8. Bytecode… • Byte-code is a standardized machine independent, low level language. The byte code files are loaded and interpreted at the client’s machine by a special program called Java Virtual Machine(JVM). • For Example : An HTML document downloaded to your machine by a browser might embed a Java data entry applet. When we activate this applet, the byte code files are executed by the browser's JVM. PRANVEER SINGH INSTITUTE OF TECHNOLOGY, KANPUR
  • 9. Bytecode… • When a user runs a Java Program , it is upto the JVM to load, possibly verify and then execute it. • The JVM can perform this function from within a browser or any other container program or directly on top of the operating system. PRANVEER SINGH INSTITUTE OF TECHNOLOGY, KANPUR
  • 10. What actually JVM does... • It validates the requested byte codes verifying that they pass various formatting and security checks. This is a security feature known as Byte-code-verifier. • It allocates memory for the incoming Java class files and guarantees that the security of JVM is not violated. This is known as class loader. • It interprets the byte-code instructions found in the class files to execute the program. PRANVEER SINGH INSTITUTE OF TECHNOLOGY, KANPUR
  • 11. Java Development Kit... • The JDK comes with a collection of tools that are used for developing and running Java Programs. • appletviewer (for viewing Java applets) • javac (Java compiler) • java (Java Interpreter) • javap ( Java diassembler) • javah (for C header files) • jdb (Java debugger)
  • 12. PRANVEER SINGH INSTITUTE OF TECHNOLOGY, KANPUR Installation of Java 1. First Of all you have a .exe file of Jdk1.7(if not then download from Oracle Site). 2. Now this exe file can be save anywhere (let us consider D: drive) 3. Open d: drive and double click on jdk1.7 exe file. 4. Press Next button until complete. 5. Now check where java is installed in your machine. 6. If java is successfully installed it means the path where java is installed should be(default path): 7. C:program File(X86)javajdk1.7
  • 13. PRANVEER SINGH INSTITUTE OF TECHNOLOGY, KANPUR • Doble click on the java installation exe file
  • 14. PRANVEER SINGH INSTITUTE OF TECHNOLOGY, KANPUR Click Next Button
  • 15. PRANVEER SINGH INSTITUTE OF TECHNOLOGY, KANPUR
  • 16. PRANVEER SINGH INSTITUTE OF TECHNOLOGY, KANPUR
  • 17. First Java Application Program... import java.lang.*; class Firstapp { public static void main(String args[ ]) { System.out.println(“This is First Application”); } } PRANVEER SINGH INSTITUTE OF TECHNOLOGY, KANPUR
  • 18. • Explanation: • For most computer languages, the name of file that holds the source code to a program is arbitrary. However this is not the case with Java. The first thing you must learn about Java is that the name you give to a source file should match the name of the class holds the main() method. So, in our case name of program is none other than Firstapp.java. This is because the source file is officially called a compilation unit. Extension is also four character long, so your OS must support long extensions. First Java Application Program... PRANVEER SINGH INSTITUTE OF TECHNOLOGY, KANPUR
  • 19. Explanation: First statement import java.lang.*; The purpose of this statement to instruct interpreter to load language package lang. Second statement class Firstapp Declares a class name firstapp so as to place everything inside this class. Third statement public static void main(String args[ ]) Defines a method main. This is the starting point for First Java Application Program... PRANVEER SINGH INSTITUTE OF TECHNOLOGY, KANPUR
  • 20. • the interpreter to begin the execution of program. Here public is an access specifier that declares the main method as unprotected and therefore making it accessible to all other classes. • Next appears the keyword static which declares this method as one that belongs to the entire class and not a part of any objects of the class. The main must always be declared as static since the interpreter uses this method before any objects are created. The type modifier void states that main method does not return any value. First Java Application Program... PRANVEER SINGH INSTITUTE OF TECHNOLOGY, KANPUR
  • 21. • In main(), there is only one parameter String args[ ] • declared a parameter named args, which is an array of objects of the class String. Objects of type String store character strings. args receives any command-line arguments present when the program is executed. This program does not make use of this information. First Java Application Program... PRANVEER SINGH INSTITUTE OF TECHNOLOGY, KANPUR
  • 22. • Fourth statement is System.out.println(“This is First Application”); • The println mehtod is a member of the out object, which is a static data member of System class. This line prints the string to the screen. The method println always appends a newline character to the end of the string. So for the output to be printed on the same line use print in place of println. First Java Application Program... PRANVEER SINGH INSTITUTE OF TECHNOLOGY, KANPUR
  • 23. • To compile the Java program, execute the compiler, javac, specifying the name of the source file on command line: • C:> javac Firstapp.java • The javac compiler creates a file called Firstapp.class that contains the bytecode version of the program. The bytecode is the intermediate representation of your program that contains instructions the Java Interpreter will execute. So, to run your program you use Java interpreter java. • C:> java Firstapp First Java Application Program... PRANVEER SINGH INSTITUTE OF TECHNOLOGY, KANPUR
  • 24. • When Java source code is compiled each individual class is put its own output file named after the class and using the .class extension. This is why it is important to give source the same name as the class they contain, so when you execute your program you are actually executing the class by the interpreter. It will automatically search for a file by that name that has the .class extension. If it finds the file, it will execute the code contained in the specified class. First Java Application Program... PRANVEER SINGH INSTITUTE OF TECHNOLOGY, KANPUR
  • 25. PRANVEER SINGH INSTITUTE OF TECHNOLOGY, KANPUR Eclipse IDE(LUNA Version) 1.First Of All you should be download Eclipse Luna Version and paste Zip format anywhere (Suppose D: drive )
  • 26. • Now Extract this zip Folder in same here like….. PRANVEER SINGH INSTITUTE OF TECHNOLOGY, KANPUR
  • 27. • Now DoubleClick on eclipse folder and search eclipse.exe • DoubleClick on eclipse icon(.exe) PRANVEER SINGH INSTITUTE OF TECHNOLOGY, KANPUR
  • 28. • Select the workspace PRANVEER SINGH INSTITUTE OF TECHNOLOGY, KANPUR
  • 29. PRANVEER SINGH INSTITUTE OF TECHNOLOGY, KANPUR
  • 30. • Now How to java Program run • Go to File->Java Project PRANVEER SINGH INSTITUTE OF TECHNOLOGY, KANPUR
  • 31. • Now provide the name of Project PRANVEER SINGH INSTITUTE OF TECHNOLOGY, KANPUR
  • 32. • Click Next Button PRANVEER SINGH INSTITUTE OF TECHNOLOGY, KANPUR
  • 33. • Now click on finish button • See the project Test of Left Pane and Expand this PRANVEER SINGH INSTITUTE OF TECHNOLOGY, KANPUR
  • 34. • Now right click on “src” folder select New- >Class PRANVEER SINGH INSTITUTE OF TECHNOLOGY, KANPUR
  • 35. • Provide the class name we provide “Hello” PRANVEER SINGH INSTITUTE OF TECHNOLOGY, KANPUR
  • 36. • Write the code on Hello Class File Like PRANVEER SINGH INSTITUTE OF TECHNOLOGY, KANPUR
  • 37. • Now right Click On Hello.java select RunAs- >Java Application PRANVEER SINGH INSTITUTE OF TECHNOLOGY, KANPUR