SlideShare a Scribd company logo
1 of 37
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

Similar to Lecture1_Introduction.ppt

Java-1st.pptx about Java technology before oops
Java-1st.pptx about Java technology before oopsJava-1st.pptx about Java technology before oops
Java-1st.pptx about Java technology before oops
buvanabala
 

Similar to Lecture1_Introduction.ppt (20)

Java Programming
Java ProgrammingJava Programming
Java Programming
 
Java1
Java1Java1
Java1
 
Java
Java Java
Java
 
oop unit1.pptx
oop unit1.pptxoop unit1.pptx
oop unit1.pptx
 
CORE JAVA
CORE JAVACORE JAVA
CORE JAVA
 
CS8392 OOP
CS8392 OOPCS8392 OOP
CS8392 OOP
 
Java Programming concept
Java Programming concept Java Programming concept
Java Programming concept
 
Letest
LetestLetest
Letest
 
Java programming basics
Java programming basicsJava programming basics
Java programming basics
 
Java
JavaJava
Java
 
JAVA BOOK BY SIVASANKARI
JAVA BOOK BY SIVASANKARIJAVA BOOK BY SIVASANKARI
JAVA BOOK BY SIVASANKARI
 
java: basics, user input, data type, constructor
java:  basics, user input, data type, constructorjava:  basics, user input, data type, constructor
java: basics, user input, data type, constructor
 
Java-1st.pptx about Java technology before oops
Java-1st.pptx about Java technology before oopsJava-1st.pptx about Java technology before oops
Java-1st.pptx about Java technology before oops
 
Introduction to java programming part 1
Introduction to java programming   part 1Introduction to java programming   part 1
Introduction to java programming part 1
 
Java For beginners and CSIT and IT students
Java  For beginners and CSIT and IT studentsJava  For beginners and CSIT and IT students
Java For beginners and CSIT and IT students
 
Java Notes by C. Sreedhar, GPREC
Java Notes by C. Sreedhar, GPRECJava Notes by C. Sreedhar, GPREC
Java Notes by C. Sreedhar, GPREC
 
Java Notes
Java Notes Java Notes
Java Notes
 
Java introduction
Java introductionJava introduction
Java introduction
 
Introduction java programming
Introduction java programmingIntroduction java programming
Introduction java programming
 
1.introduction to java
1.introduction to java1.introduction to java
1.introduction to java
 

Recently uploaded

Integrated Test Rig For HTFE-25 - Neometrix
Integrated Test Rig For HTFE-25 - NeometrixIntegrated Test Rig For HTFE-25 - Neometrix
Integrated Test Rig For HTFE-25 - Neometrix
Neometrix_Engineering_Pvt_Ltd
 
+97470301568>> buy weed in qatar,buy thc oil qatar,buy weed and vape oil in d...
+97470301568>> buy weed in qatar,buy thc oil qatar,buy weed and vape oil in d...+97470301568>> buy weed in qatar,buy thc oil qatar,buy weed and vape oil in d...
+97470301568>> buy weed in qatar,buy thc oil qatar,buy weed and vape oil in d...
Health
 
DeepFakes presentation : brief idea of DeepFakes
DeepFakes presentation : brief idea of DeepFakesDeepFakes presentation : brief idea of DeepFakes
DeepFakes presentation : brief idea of DeepFakes
MayuraD1
 
notes on Evolution Of Analytic Scalability.ppt
notes on Evolution Of Analytic Scalability.pptnotes on Evolution Of Analytic Scalability.ppt
notes on Evolution Of Analytic Scalability.ppt
MsecMca
 
scipt v1.pptxcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...
scipt v1.pptxcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...scipt v1.pptxcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...
scipt v1.pptxcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...
HenryBriggs2
 
Kuwait City MTP kit ((+919101817206)) Buy Abortion Pills Kuwait
Kuwait City MTP kit ((+919101817206)) Buy Abortion Pills KuwaitKuwait City MTP kit ((+919101817206)) Buy Abortion Pills Kuwait
Kuwait City MTP kit ((+919101817206)) Buy Abortion Pills Kuwait
jaanualu31
 

Recently uploaded (20)

Integrated Test Rig For HTFE-25 - Neometrix
Integrated Test Rig For HTFE-25 - NeometrixIntegrated Test Rig For HTFE-25 - Neometrix
Integrated Test Rig For HTFE-25 - Neometrix
 
+97470301568>> buy weed in qatar,buy thc oil qatar,buy weed and vape oil in d...
+97470301568>> buy weed in qatar,buy thc oil qatar,buy weed and vape oil in d...+97470301568>> buy weed in qatar,buy thc oil qatar,buy weed and vape oil in d...
+97470301568>> buy weed in qatar,buy thc oil qatar,buy weed and vape oil in d...
 
Thermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.pptThermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.ppt
 
AIRCANVAS[1].pdf mini project for btech students
AIRCANVAS[1].pdf mini project for btech studentsAIRCANVAS[1].pdf mini project for btech students
AIRCANVAS[1].pdf mini project for btech students
 
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptxS1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
 
DeepFakes presentation : brief idea of DeepFakes
DeepFakes presentation : brief idea of DeepFakesDeepFakes presentation : brief idea of DeepFakes
DeepFakes presentation : brief idea of DeepFakes
 
notes on Evolution Of Analytic Scalability.ppt
notes on Evolution Of Analytic Scalability.pptnotes on Evolution Of Analytic Scalability.ppt
notes on Evolution Of Analytic Scalability.ppt
 
Learn the concepts of Thermodynamics on Magic Marks
Learn the concepts of Thermodynamics on Magic MarksLearn the concepts of Thermodynamics on Magic Marks
Learn the concepts of Thermodynamics on Magic Marks
 
Work-Permit-Receiver-in-Saudi-Aramco.pptx
Work-Permit-Receiver-in-Saudi-Aramco.pptxWork-Permit-Receiver-in-Saudi-Aramco.pptx
Work-Permit-Receiver-in-Saudi-Aramco.pptx
 
scipt v1.pptxcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...
scipt v1.pptxcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...scipt v1.pptxcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...
scipt v1.pptxcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...
 
Hostel management system project report..pdf
Hostel management system project report..pdfHostel management system project report..pdf
Hostel management system project report..pdf
 
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
 
Kuwait City MTP kit ((+919101817206)) Buy Abortion Pills Kuwait
Kuwait City MTP kit ((+919101817206)) Buy Abortion Pills KuwaitKuwait City MTP kit ((+919101817206)) Buy Abortion Pills Kuwait
Kuwait City MTP kit ((+919101817206)) Buy Abortion Pills Kuwait
 
Computer Networks Basics of Network Devices
Computer Networks  Basics of Network DevicesComputer Networks  Basics of Network Devices
Computer Networks Basics of Network Devices
 
Tamil Call Girls Bhayandar WhatsApp +91-9930687706, Best Service
Tamil Call Girls Bhayandar WhatsApp +91-9930687706, Best ServiceTamil Call Girls Bhayandar WhatsApp +91-9930687706, Best Service
Tamil Call Girls Bhayandar WhatsApp +91-9930687706, Best Service
 
A CASE STUDY ON CERAMIC INDUSTRY OF BANGLADESH.pptx
A CASE STUDY ON CERAMIC INDUSTRY OF BANGLADESH.pptxA CASE STUDY ON CERAMIC INDUSTRY OF BANGLADESH.pptx
A CASE STUDY ON CERAMIC INDUSTRY OF BANGLADESH.pptx
 
Introduction to Serverless with AWS Lambda
Introduction to Serverless with AWS LambdaIntroduction to Serverless with AWS Lambda
Introduction to Serverless with AWS Lambda
 
Double Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torqueDouble Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torque
 
Block diagram reduction techniques in control systems.ppt
Block diagram reduction techniques in control systems.pptBlock diagram reduction techniques in control systems.ppt
Block diagram reduction techniques in control systems.ppt
 
Hazard Identification (HAZID) vs. Hazard and Operability (HAZOP): A Comparati...
Hazard Identification (HAZID) vs. Hazard and Operability (HAZOP): A Comparati...Hazard Identification (HAZID) vs. Hazard and Operability (HAZOP): A Comparati...
Hazard Identification (HAZID) vs. Hazard and Operability (HAZOP): A Comparati...
 

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