SlideShare une entreprise Scribd logo
1  sur  28
JAVA PROGRAMMING
Ms.Snehal Kulthe
Department of Management
INTRODUCTION
 Required Knowledge
Basic Knowledge of C
Programming and C++ will help you to
understand Java Programming quickly, and If
you don't know programming and you are
studying Java, so it's quite complicated.
 Java Example
A quick look at the example of Hello
Java program and the detailed description is
given in Java Program Structure page.
EXAMPLE
 public class Hello
 {
 public static void main(String[] args)
 {
 System.out.println("Hello Java");
 }
 }
 Program Output:
 Hello Java
 The above example has been used to print Hello
Java text on the screen.
 Java is an object-oriented programming
language with its runtime environment. It is a
combination of features of C and C++ with
some essential additional concepts. Java is
well suited for both standalone and web
application development and is designed to
provide solutions to most of the problems
faced by users of the internet era.
WHAT IS JAVA
 Java is an object-oriented programming language developed
by Sun Microsystems, and it was released in 1995.
 James Gosling initially developed Java in Sun
Microsystems (which was later merged with Oracle Corporation).
 Java is a set of features of C and C++. It has obtained its format
from C, and OOP features from C++.
 Java programs are platform independent which means they can
be run on any operating system with any processor as long as
the Java interpreter is available on that system.
 Java code that runs on one platform does not need to be
recompiled to run on another platform; it's called write once, run
anywhere(WORA).
 Java Virtual Machine (JVM) executes Java code, but it has been
written in platform-specific languages such as C/C++/ASM, etc.
JVM is not written in Java and hence cannot be platform
independent, and Java interpreter is a part of JVM.
WHERE IS JAVA BEING USED
 Earlier Java was only used to design and program small computing
devices, but it was later adopted as one of the platform-independent
programming languages, and now according to Sun, 3 billion devices
run Java.
 Java is one of the most important programming languages in today's IT
industries.
 JSP - In Java, JSP (Java Server Pages) is used to create dynamic web
pages, such as in PHP and ASP.
 Applets - Applets are another type of Java programs that are
implemented on Internet browsers and are always run as part of a web
document.
 J2EE - Java 2 Enterprise Edition is a platform-independent environment
that is a set of different protocols and APIs and is used by various
organizations to transfer data between each other.
 JavaBeans - This is a set of reusable software components that can be
easily used to create new and advanced applications.
 Mobile - In addition to the above technology, Java is widely used in
mobile devices nowadays, many types of games and applications are
being made in Java.
TYPES OF JAVA APPLICATION
 Web Application - Java is used to create server-side web
applications. Currently, Servlet, JSP, Struts, JSF, etc.
technologies are used.
 Standalone Application - It is also known as the desktop
application or window-based application. An application that we
need to install on every machine or server such as media player,
antivirus, etc. AWT and Swing are used in java for creating
standalone applications.
 Enterprise Application - An application that is distributed in nature,
such as banking applications, etc. It has the advantage of the
high-level security, load balancing, and clustering. In Java, EJB is
used for creating enterprise applications.
 Mobile Application - Java is used to create application software
for mobile devices. Currently, Java ME is used for building
applications for small devices, and also Java is a programming
language for Google Android application development.
FEATURES OF JAVA
 Object-Oriented - Java supports the features of object-oriented programming. Its
object model is simple and easy to expand.
 Platform independent - C and C++ are platform dependency languages hence
the application programs written in one Operating system cannot run in any
other Operating system, but in platform independence language like Java
application programs written in one Operating system can able to run on any
Operating system.
 Simple - Java has included many features of C / C ++, which makes it easy to
understand.
 Secure - Java provides a wide range of protection from viruses and malicious
programs. It ensures that there will be no damage and no security will be
broken.
 Portable - Java provides us the concept of portability. Running the same
program with Java on different platforms is possible.
 Robust - During the development of the program, it helps us to find possible
mistakes as soon as possible.
 Multi-threaded - The multithreading programming feature in Java allows you to
write a program that performs several different tasks simultaneously.
 Distributed - Java is designed for distributed Internet environments as it
manages the TCP/IP protocol.
 Popular Java Editors
POPULAR JAVA EDITOR
 Notepad - On Windows machine, you can
use any simple text editor like Notepad
(Recommended for this tutorial), TextPad.
 Netbeans - is a Java IDE that is open source
and free which can be downloaded
from http://www.netbeans.org/index.html
 Eclipse - is also a java IDE developed by the
Eclipse open source community and can be
downloaded from http://www.eclipse.org/
EVOLUTION OF JAVA
 The development of each programming language is
based on a fact: there is a need to solve a problem that
was not resolved by previous programming languages.
Early programmers had to choose different programming
languages, usually for various tasks, such as a specific
language for a type of field. A certain language was
sufficient to solve the problems of its field but was not
able to solve the problems of other fields. For
example, Fortran could have been used to write efficient
programs for scientific problems, but it was not good for
system code. Similarly, Basic was easy to understand but
was not robust to write big programs; While the assembly
language was powerful for writing efficient programs, but
it was not easy to remember and execution.
 Programming languages such as Cobol, Fortran do not have
structural principles. They use the Goto statement to control
the flow of the program. Therefore, programs using this type
of code are made up of many jumps and conditional
statements that make it difficult to understand.
 Therefore, C was invented in 1970, to replace the assembly
language and to create a structured, effective and high-level
language. The development of C was the result of the
development process started with BCPL by Dennis
Ritchie. BCPL is an old language developed by Martin
Richard. Ken Thompson developed a language called B,
which was influenced by BCPL.
 C is a processor-oriented programming language; it is easy to
execute and understand. C became quite famous at that time
because it was reliable, simple and easy to use.
 Though C was quite efficient and successful programming language,
the complexity of the program was seeking more efficient language
to solve problems. When we write a program in C, it has a limit, such
as a maximum of 25000 lines of code, beyond which it can not
handle the complexity. But writing and managing large programs
was a demand at that time. So a new concept came.
 C++ came with object-oriented programming features. C++ is the
extension of C language which has been used extensively. It is a
powerful modern language that includes the power and simplicity of
C and the characteristics of OOP. C++ provides more functional
software benefits than C.
 C ++ with OOP became quite famous but then a new problem arose,
to control the software on different machines, a separate compiler is
required for that CPU. But building a C++ compiler was quite
expensive. Therefore, an efficient and easy solution was needed,
and this requirement became the reason for the creation of Java,
which is a portable and platform-independent language.
HISTORY OF JAVA TECHNOLOGY
 History of Java programming language is usually
associated with origin predates of the web. James
Gosling, Patrick Naughton, Chris Warth, Mike
Sheridan and Ed Frank initiated the Java language
project in June 1991. The idea was to develop a
language which was platform-independent and which
could create embedded software for consumer
electronic devices. It took 18 months to develop and
had an initial name as Oak which was renamed
to Java in 1995, due to copyright issues.

JAVA VERSION RELEASE HISTORY
 Version Released on
 JDK1.023 Jan 1996
 JDK1.119 Feb 1997
 J2SE 1.28 Dec 1998
 J2SE 1.38 May 2000
 J2SE 1.46 Feb 2002
 J2SE 5.030 Sept 2004
 Java SE 611 Dec 2006
 Java SE 7.028 July 2011
 Java SE 8.018 March 2014
 Java SE 9.0Sept 2017
 Java SE 10 (18.3)2018
JAVA PROGRAM STRUCTURE
 It is necessary to know the exact structure of
the Java program, and this lesson contains a
detailed description of it. This lesson is
essential for you before proceeding to learn
more advanced lessons of Java
programming. Here, in this chapter, you will
study the structure of the Java program.
Such as how to create a simple Java
program and what its different sections
mean.
BASIC STRUCTURE OF JAVA PROGRAM
 A Java program involves the following
sections:
 Documentation Section
 Package Statement
 Import Statements
 Interface Statement
 Class Definition
 Main Method Class
 Main Method Definition
Section Description
Documentation Section You can write a comment in this section.
Comments are beneficial for the
programmer because they help them
understand the code. These are optional,
but we suggest you use them because they
are useful to understand the operation of
the program, so you must write comments
within the program.
Package statement You can create a package with any name.
A package is a group of classes that are
defined by a name. That is, if you want to
declare many classes within one element,
then you can declare it within a package. It
is an optional part of the program, i.e., if
you do not want to declare any package,
then there will be no problem with it, and
you will not get any errors. Here, the
package is a keyword that tells the
compiler that package has been created.It
is declared as:
package package_name;
Import statements This line indicates that if you want to
use a class of another package, then
you can do this by importing it directly
into your program.
Example:import calc.add;
Interface statement Interfaces are like a class that includes a
group of method declarations. It's an
optional section and can be used when
programmers want to implement multiple
inheritances within a program.
Class Definition A Java program may contain several class
definitions. Classes are the main and
essential elements of any Java program.
Main Method Class Every Java stand-alone program requires
the main method as the starting point of the
program. This is an essential part of a Java
program. There may be many classes in a
Java program, and only one class defines
the main method. Methods contain data
type declaration and executable
statements.
SIMPLE JAVA PROGRAM
//Name of this file will be "Hello.java"
public class Hello
{
/* Writes the words "Hello Java" on the screen */
public static void main(String[] args)
{
System.out.println("Hello Java");
}
}
Program output:
Hello Java
public class Hello •This creates a class called Hello.
•All class names must start with a
capital letter.
•The public word means that it is
accessible from any other classes.
/* Comments */ The compiler ignores comment block.
Comment can be used anywhere in
the program to add info about program
or code block, which will be helpful for
developers to understand the existing
code in the future easily.
Braces Two curly brackets {...} are used to
group all the commands, so it is
known that the commands belong to
that class or method.
public static void main •When the main method is declared public, it
means that it can also be used by code
outside of its class, due to which the main
method is declared public.
•The word static used when we want to
access a method without creating its
object, as we call the main method, before
creating any class objects.
•The word void indicates that a method does
not return a value. main() is declared as
void because it does not return a value.
•main is a method; this is a starting point of
a Java program.
You will notice that the main method code
has been moved to some spaces left. It is
called indentation which used to make a
program easier to read and understand.
String[] args It is an array where each element of it is a
string, which has been named as "args". If your
Java program is run through the console, you
can pass input parameter, and main() method
takes it as input.
System.out.println(); This statement is used to print text on the
screen as output, where system is a predefined
class, and out is an object of the PrintWriter
class defined in the system. The
method println prints the text on the screen with
a new line. You can also use print()method
DIFFERENCE OF JAVA C CPP
C CPP JAVA
Language Procedural Object oriented Pure object Oriented
Header file Stdio.h Iostream.h
conio.h
Java does not
support any header
file
Platform Dependant Dependant Independent
Pointers Support Support Does not Support
Operator
overloading
Not used Used Not used
Multiple Inheritance Not used Used Instead of this we
use Interface
Translator Compiler Compiler Compiler and
interpreter
Web Application Not used Not used Internet
programming like
Frame,Applet
C CPP JAVA
Operator Dot operator Dot Operator Dot Operator
Package Not Create Not Create Create own
Package
Program #include<stdio.h>
//header file for
standard input and
output
main() //ma
in method
{
clrscr(); //clear
the screen
printf(“welcome”); //
print the message
getch(); //get the
character
}
#include<iostream.h
> //header file
necessary for input
output stream
#include<conio.h>
//headerfile for
console input output
main() //main
method
{
clrscr(); //clear the
screen
cout<<”welcome”; /
/cout is used for
output
getch(); //get the
character
}
class
main //program
always start with
class because of
pure object oriented
language
{
public static void
main(String
aa[]) //main method
{
System.out.print(“we
lcome”); //print the
message
}
}
JAVA SUPPORT SYSTEM & ENVIRONMENT
 The Java Virtual Machine is called JVM, is an
abstract computing machine or virtual mac
hine interface that drives the java code.
 When we talk about the Java applications,
then it works only on those machines which
have JVM.
WHAT IS JVM
 JVM i.e., Java Virtual Machine.
 JVM is the engine that drives the Java code.
 Mostly in other Programming Languages, compiler
produce code for a particular system but Java compiler
produce Bytecode for a Java Virtual Machine.
 When we compile a Java program, then bytecode is
generated. Bytecode is the source code that can be used
to run on any platform.
 Bytecode is an intermediary language between Java
source and the host system.
 It is the medium which compiles Java code to bytecode
which gets interpreted on a different machine and hence it
makes it Platform/Operating system independent.
JVM'S WORK CAN BE EXPLAINED IN THE
FOLLOWING MANNER.
 Reading Bytecode.
 Verifying bytecode.
 Linking the code with the library.
 Diagram of JVM
 JVM generates a .class(Bytecode) file, and that file can be
run in any OS, but JVM should have in OS because JVM is
platform dependent.
PLATFORM INDEPENDENT
 Java is called platform independent because of
Java Virtual Machine. As different computers with
the different operating system have their JVM,
when we submit a .class file to any operating
system, JVM interprets the bytecode into machine
level language.
 JVM is the main component of Java architecture,
and it is the part of the JRE (Java Runtime
Environment).
 A program of JVM is written in C Programming
Language, and JVM is Operating System
dependent.
 JVM is responsible for allocating the necessary
memory needed by the Java program.
 JVM is responsible for deallocating memory space.
Thank You

Contenu connexe

Tendances

Blow fish final ppt
Blow fish final pptBlow fish final ppt
Blow fish final pptAjay AJ
 
Machine Learning Based Botnet Detection
Machine Learning Based Botnet DetectionMachine Learning Based Botnet Detection
Machine Learning Based Botnet Detectionbutest
 
Introduction to cybercrime
Introduction to cybercrimeIntroduction to cybercrime
Introduction to cybercrimepatelripal99
 
Cybersecurity in an IoT and Mobile World
Cybersecurity in an IoT and Mobile WorldCybersecurity in an IoT and Mobile World
Cybersecurity in an IoT and Mobile WorldAhmed Abu Eldahab
 
IoT Malware Detection through Threshold Random Walks
IoT Malware Detection through Threshold Random WalksIoT Malware Detection through Threshold Random Walks
IoT Malware Detection through Threshold Random WalksBiagio Botticelli
 
Computer Security | Types of Computer Security | Cybersecurity Course | Edureka
Computer Security | Types of Computer Security | Cybersecurity Course | EdurekaComputer Security | Types of Computer Security | Cybersecurity Course | Edureka
Computer Security | Types of Computer Security | Cybersecurity Course | EdurekaEdureka!
 
Mobile Device Security
Mobile Device SecurityMobile Device Security
Mobile Device SecurityNemwos
 
Java database connectivity
Java database connectivityJava database connectivity
Java database connectivityVaishali Modi
 
Encryption And Decryption
Encryption And DecryptionEncryption And Decryption
Encryption And DecryptionNA
 
basic encryption and decryption
 basic encryption and decryption basic encryption and decryption
basic encryption and decryptionRashmi Burugupalli
 
DDoS Attack Detection and Botnet Prevention using Machine Learning
DDoS Attack Detection and Botnet Prevention using Machine LearningDDoS Attack Detection and Botnet Prevention using Machine Learning
DDoS Attack Detection and Botnet Prevention using Machine LearningIRJET Journal
 
Cyber Security
Cyber SecurityCyber Security
Cyber SecurityRamiro Cid
 
Importance of cyber security in education sector
Importance of cyber security in education sectorImportance of cyber security in education sector
Importance of cyber security in education sectorSeqrite
 

Tendances (20)

Blow fish final ppt
Blow fish final pptBlow fish final ppt
Blow fish final ppt
 
Machine Learning Based Botnet Detection
Machine Learning Based Botnet DetectionMachine Learning Based Botnet Detection
Machine Learning Based Botnet Detection
 
Introduction to cybercrime
Introduction to cybercrimeIntroduction to cybercrime
Introduction to cybercrime
 
Cybersecurity in an IoT and Mobile World
Cybersecurity in an IoT and Mobile WorldCybersecurity in an IoT and Mobile World
Cybersecurity in an IoT and Mobile World
 
IoT Malware Detection through Threshold Random Walks
IoT Malware Detection through Threshold Random WalksIoT Malware Detection through Threshold Random Walks
IoT Malware Detection through Threshold Random Walks
 
cyber crime
cyber crimecyber crime
cyber crime
 
Computer forensics ppt
Computer forensics pptComputer forensics ppt
Computer forensics ppt
 
Cyber crime & security
Cyber crime & securityCyber crime & security
Cyber crime & security
 
Computer Security | Types of Computer Security | Cybersecurity Course | Edureka
Computer Security | Types of Computer Security | Cybersecurity Course | EdurekaComputer Security | Types of Computer Security | Cybersecurity Course | Edureka
Computer Security | Types of Computer Security | Cybersecurity Course | Edureka
 
Computer and network security
Computer and network securityComputer and network security
Computer and network security
 
Cyber law in nepal and implementation
Cyber law in nepal and implementationCyber law in nepal and implementation
Cyber law in nepal and implementation
 
Mobile Device Security
Mobile Device SecurityMobile Device Security
Mobile Device Security
 
Java database connectivity
Java database connectivityJava database connectivity
Java database connectivity
 
Encryption And Decryption
Encryption And DecryptionEncryption And Decryption
Encryption And Decryption
 
basic encryption and decryption
 basic encryption and decryption basic encryption and decryption
basic encryption and decryption
 
DDoS Attack Detection and Botnet Prevention using Machine Learning
DDoS Attack Detection and Botnet Prevention using Machine LearningDDoS Attack Detection and Botnet Prevention using Machine Learning
DDoS Attack Detection and Botnet Prevention using Machine Learning
 
Cyber Security
Cyber SecurityCyber Security
Cyber Security
 
Importance of cyber security in education sector
Importance of cyber security in education sectorImportance of cyber security in education sector
Importance of cyber security in education sector
 
Caesar cipher
Caesar cipherCaesar cipher
Caesar cipher
 
Web Application Security 101
Web Application Security 101Web Application Security 101
Web Application Security 101
 

Similaire à Java

Java application-development
Java application-developmentJava application-development
Java application-developmentDeepika Chaudhary
 
Java Programming (M&M)
Java Programming (M&M)Java Programming (M&M)
Java Programming (M&M)mafffffe19
 
java introduction.docx
java introduction.docxjava introduction.docx
java introduction.docxvikasbagra9887
 
Features of java unit 1
Features of java unit 1Features of java unit 1
Features of java unit 1RubaNagarajan
 
C,c++,java,php,.net training institute in delhi, best training institute for ...
C,c++,java,php,.net training institute in delhi, best training institute for ...C,c++,java,php,.net training institute in delhi, best training institute for ...
C,c++,java,php,.net training institute in delhi, best training institute for ...MCM COmpetitive Classes
 
Core Java Slides
Core Java SlidesCore Java Slides
Core Java SlidesVinit Vyas
 
Chapter 1 introduction to java technology
Chapter 1 introduction to java technologyChapter 1 introduction to java technology
Chapter 1 introduction to java technologysshhzap
 
Java report by ravi raja
Java report by ravi rajaJava report by ravi raja
Java report by ravi rajaRaviRaja55
 
TechSearchWeb Tutorials.pdf
TechSearchWeb Tutorials.pdfTechSearchWeb Tutorials.pdf
TechSearchWeb Tutorials.pdfTechSearchWeb
 
Introduction to java
Introduction to  javaIntroduction to  java
Introduction to javaKalai Selvi
 
Java Tutorial to Learn Java Programming
Java Tutorial to Learn Java ProgrammingJava Tutorial to Learn Java Programming
Java Tutorial to Learn Java Programmingbusiness Corporate
 

Similaire à Java (20)

Java Programming Basics
Java Programming BasicsJava Programming Basics
Java Programming Basics
 
Java application-development
Java application-developmentJava application-development
Java application-development
 
Java Notes .pdf
Java Notes .pdfJava Notes .pdf
Java Notes .pdf
 
Java Programming (M&M)
Java Programming (M&M)Java Programming (M&M)
Java Programming (M&M)
 
java introduction.docx
java introduction.docxjava introduction.docx
java introduction.docx
 
Features of java unit 1
Features of java unit 1Features of java unit 1
Features of java unit 1
 
C,c++,java,php,.net training institute in delhi, best training institute for ...
C,c++,java,php,.net training institute in delhi, best training institute for ...C,c++,java,php,.net training institute in delhi, best training institute for ...
C,c++,java,php,.net training institute in delhi, best training institute for ...
 
130700548484460000
130700548484460000130700548484460000
130700548484460000
 
Core Java Slides
Core Java SlidesCore Java Slides
Core Java Slides
 
Java presentation
Java presentationJava presentation
Java presentation
 
Java Intro
Java IntroJava Intro
Java Intro
 
Chapter 1 introduction to java technology
Chapter 1 introduction to java technologyChapter 1 introduction to java technology
Chapter 1 introduction to java technology
 
Java report by ravi raja
Java report by ravi rajaJava report by ravi raja
Java report by ravi raja
 
BlueJ Two
BlueJ TwoBlueJ Two
BlueJ Two
 
Java
JavaJava
Java
 
TechSearchWeb Tutorials.pdf
TechSearchWeb Tutorials.pdfTechSearchWeb Tutorials.pdf
TechSearchWeb Tutorials.pdf
 
Lecture 1
Lecture 1Lecture 1
Lecture 1
 
Introduction to java
Introduction to  javaIntroduction to  java
Introduction to java
 
Java Basic.pdf
Java Basic.pdfJava Basic.pdf
Java Basic.pdf
 
Java Tutorial to Learn Java Programming
Java Tutorial to Learn Java ProgrammingJava Tutorial to Learn Java Programming
Java Tutorial to Learn Java Programming
 

Dernier

Nanoparticles synthesis and characterization​ ​
Nanoparticles synthesis and characterization​  ​Nanoparticles synthesis and characterization​  ​
Nanoparticles synthesis and characterization​ ​kaibalyasahoo82800
 
PossibleEoarcheanRecordsoftheGeomagneticFieldPreservedintheIsuaSupracrustalBe...
PossibleEoarcheanRecordsoftheGeomagneticFieldPreservedintheIsuaSupracrustalBe...PossibleEoarcheanRecordsoftheGeomagneticFieldPreservedintheIsuaSupracrustalBe...
PossibleEoarcheanRecordsoftheGeomagneticFieldPreservedintheIsuaSupracrustalBe...Sérgio Sacani
 
Isotopic evidence of long-lived volcanism on Io
Isotopic evidence of long-lived volcanism on IoIsotopic evidence of long-lived volcanism on Io
Isotopic evidence of long-lived volcanism on IoSérgio Sacani
 
Discovery of an Accretion Streamer and a Slow Wide-angle Outflow around FUOri...
Discovery of an Accretion Streamer and a Slow Wide-angle Outflow around FUOri...Discovery of an Accretion Streamer and a Slow Wide-angle Outflow around FUOri...
Discovery of an Accretion Streamer and a Slow Wide-angle Outflow around FUOri...Sérgio Sacani
 
Botany krishna series 2nd semester Only Mcq type questions
Botany krishna series 2nd semester Only Mcq type questionsBotany krishna series 2nd semester Only Mcq type questions
Botany krishna series 2nd semester Only Mcq type questionsSumit Kumar yadav
 
Recombination DNA Technology (Nucleic Acid Hybridization )
Recombination DNA Technology (Nucleic Acid Hybridization )Recombination DNA Technology (Nucleic Acid Hybridization )
Recombination DNA Technology (Nucleic Acid Hybridization )aarthirajkumar25
 
Biological Classification BioHack (3).pdf
Biological Classification BioHack (3).pdfBiological Classification BioHack (3).pdf
Biological Classification BioHack (3).pdfmuntazimhurra
 
Raman spectroscopy.pptx M Pharm, M Sc, Advanced Spectral Analysis
Raman spectroscopy.pptx M Pharm, M Sc, Advanced Spectral AnalysisRaman spectroscopy.pptx M Pharm, M Sc, Advanced Spectral Analysis
Raman spectroscopy.pptx M Pharm, M Sc, Advanced Spectral AnalysisDiwakar Mishra
 
GBSN - Microbiology (Unit 2)
GBSN - Microbiology (Unit 2)GBSN - Microbiology (Unit 2)
GBSN - Microbiology (Unit 2)Areesha Ahmad
 
STERILITY TESTING OF PHARMACEUTICALS ppt by DR.C.P.PRINCE
STERILITY TESTING OF PHARMACEUTICALS ppt by DR.C.P.PRINCESTERILITY TESTING OF PHARMACEUTICALS ppt by DR.C.P.PRINCE
STERILITY TESTING OF PHARMACEUTICALS ppt by DR.C.P.PRINCEPRINCE C P
 
Chemistry 4th semester series (krishna).pdf
Chemistry 4th semester series (krishna).pdfChemistry 4th semester series (krishna).pdf
Chemistry 4th semester series (krishna).pdfSumit Kumar yadav
 
Orientation, design and principles of polyhouse
Orientation, design and principles of polyhouseOrientation, design and principles of polyhouse
Orientation, design and principles of polyhousejana861314
 
Stunning ➥8448380779▻ Call Girls In Panchshil Enclave Delhi NCR
Stunning ➥8448380779▻ Call Girls In Panchshil Enclave Delhi NCRStunning ➥8448380779▻ Call Girls In Panchshil Enclave Delhi NCR
Stunning ➥8448380779▻ Call Girls In Panchshil Enclave Delhi NCRDelhi Call girls
 
Labelling Requirements and Label Claims for Dietary Supplements and Recommend...
Labelling Requirements and Label Claims for Dietary Supplements and Recommend...Labelling Requirements and Label Claims for Dietary Supplements and Recommend...
Labelling Requirements and Label Claims for Dietary Supplements and Recommend...Lokesh Kothari
 
Botany 4th semester file By Sumit Kumar yadav.pdf
Botany 4th semester file By Sumit Kumar yadav.pdfBotany 4th semester file By Sumit Kumar yadav.pdf
Botany 4th semester file By Sumit Kumar yadav.pdfSumit Kumar yadav
 
GFP in rDNA Technology (Biotechnology).pptx
GFP in rDNA Technology (Biotechnology).pptxGFP in rDNA Technology (Biotechnology).pptx
GFP in rDNA Technology (Biotechnology).pptxAleenaTreesaSaji
 
VIRUSES structure and classification ppt by Dr.Prince C P
VIRUSES structure and classification ppt by Dr.Prince C PVIRUSES structure and classification ppt by Dr.Prince C P
VIRUSES structure and classification ppt by Dr.Prince C PPRINCE C P
 
GBSN - Microbiology (Unit 1)
GBSN - Microbiology (Unit 1)GBSN - Microbiology (Unit 1)
GBSN - Microbiology (Unit 1)Areesha Ahmad
 
Nightside clouds and disequilibrium chemistry on the hot Jupiter WASP-43b
Nightside clouds and disequilibrium chemistry on the hot Jupiter WASP-43bNightside clouds and disequilibrium chemistry on the hot Jupiter WASP-43b
Nightside clouds and disequilibrium chemistry on the hot Jupiter WASP-43bSérgio Sacani
 

Dernier (20)

Nanoparticles synthesis and characterization​ ​
Nanoparticles synthesis and characterization​  ​Nanoparticles synthesis and characterization​  ​
Nanoparticles synthesis and characterization​ ​
 
PossibleEoarcheanRecordsoftheGeomagneticFieldPreservedintheIsuaSupracrustalBe...
PossibleEoarcheanRecordsoftheGeomagneticFieldPreservedintheIsuaSupracrustalBe...PossibleEoarcheanRecordsoftheGeomagneticFieldPreservedintheIsuaSupracrustalBe...
PossibleEoarcheanRecordsoftheGeomagneticFieldPreservedintheIsuaSupracrustalBe...
 
Isotopic evidence of long-lived volcanism on Io
Isotopic evidence of long-lived volcanism on IoIsotopic evidence of long-lived volcanism on Io
Isotopic evidence of long-lived volcanism on Io
 
Discovery of an Accretion Streamer and a Slow Wide-angle Outflow around FUOri...
Discovery of an Accretion Streamer and a Slow Wide-angle Outflow around FUOri...Discovery of an Accretion Streamer and a Slow Wide-angle Outflow around FUOri...
Discovery of an Accretion Streamer and a Slow Wide-angle Outflow around FUOri...
 
Botany krishna series 2nd semester Only Mcq type questions
Botany krishna series 2nd semester Only Mcq type questionsBotany krishna series 2nd semester Only Mcq type questions
Botany krishna series 2nd semester Only Mcq type questions
 
Recombination DNA Technology (Nucleic Acid Hybridization )
Recombination DNA Technology (Nucleic Acid Hybridization )Recombination DNA Technology (Nucleic Acid Hybridization )
Recombination DNA Technology (Nucleic Acid Hybridization )
 
Biological Classification BioHack (3).pdf
Biological Classification BioHack (3).pdfBiological Classification BioHack (3).pdf
Biological Classification BioHack (3).pdf
 
Raman spectroscopy.pptx M Pharm, M Sc, Advanced Spectral Analysis
Raman spectroscopy.pptx M Pharm, M Sc, Advanced Spectral AnalysisRaman spectroscopy.pptx M Pharm, M Sc, Advanced Spectral Analysis
Raman spectroscopy.pptx M Pharm, M Sc, Advanced Spectral Analysis
 
GBSN - Microbiology (Unit 2)
GBSN - Microbiology (Unit 2)GBSN - Microbiology (Unit 2)
GBSN - Microbiology (Unit 2)
 
STERILITY TESTING OF PHARMACEUTICALS ppt by DR.C.P.PRINCE
STERILITY TESTING OF PHARMACEUTICALS ppt by DR.C.P.PRINCESTERILITY TESTING OF PHARMACEUTICALS ppt by DR.C.P.PRINCE
STERILITY TESTING OF PHARMACEUTICALS ppt by DR.C.P.PRINCE
 
Chemistry 4th semester series (krishna).pdf
Chemistry 4th semester series (krishna).pdfChemistry 4th semester series (krishna).pdf
Chemistry 4th semester series (krishna).pdf
 
Orientation, design and principles of polyhouse
Orientation, design and principles of polyhouseOrientation, design and principles of polyhouse
Orientation, design and principles of polyhouse
 
Stunning ➥8448380779▻ Call Girls In Panchshil Enclave Delhi NCR
Stunning ➥8448380779▻ Call Girls In Panchshil Enclave Delhi NCRStunning ➥8448380779▻ Call Girls In Panchshil Enclave Delhi NCR
Stunning ➥8448380779▻ Call Girls In Panchshil Enclave Delhi NCR
 
9953056974 Young Call Girls In Mahavir enclave Indian Quality Escort service
9953056974 Young Call Girls In Mahavir enclave Indian Quality Escort service9953056974 Young Call Girls In Mahavir enclave Indian Quality Escort service
9953056974 Young Call Girls In Mahavir enclave Indian Quality Escort service
 
Labelling Requirements and Label Claims for Dietary Supplements and Recommend...
Labelling Requirements and Label Claims for Dietary Supplements and Recommend...Labelling Requirements and Label Claims for Dietary Supplements and Recommend...
Labelling Requirements and Label Claims for Dietary Supplements and Recommend...
 
Botany 4th semester file By Sumit Kumar yadav.pdf
Botany 4th semester file By Sumit Kumar yadav.pdfBotany 4th semester file By Sumit Kumar yadav.pdf
Botany 4th semester file By Sumit Kumar yadav.pdf
 
GFP in rDNA Technology (Biotechnology).pptx
GFP in rDNA Technology (Biotechnology).pptxGFP in rDNA Technology (Biotechnology).pptx
GFP in rDNA Technology (Biotechnology).pptx
 
VIRUSES structure and classification ppt by Dr.Prince C P
VIRUSES structure and classification ppt by Dr.Prince C PVIRUSES structure and classification ppt by Dr.Prince C P
VIRUSES structure and classification ppt by Dr.Prince C P
 
GBSN - Microbiology (Unit 1)
GBSN - Microbiology (Unit 1)GBSN - Microbiology (Unit 1)
GBSN - Microbiology (Unit 1)
 
Nightside clouds and disequilibrium chemistry on the hot Jupiter WASP-43b
Nightside clouds and disequilibrium chemistry on the hot Jupiter WASP-43bNightside clouds and disequilibrium chemistry on the hot Jupiter WASP-43b
Nightside clouds and disequilibrium chemistry on the hot Jupiter WASP-43b
 

Java

  • 2. INTRODUCTION  Required Knowledge Basic Knowledge of C Programming and C++ will help you to understand Java Programming quickly, and If you don't know programming and you are studying Java, so it's quite complicated.  Java Example A quick look at the example of Hello Java program and the detailed description is given in Java Program Structure page.
  • 3. EXAMPLE  public class Hello  {  public static void main(String[] args)  {  System.out.println("Hello Java");  }  }  Program Output:  Hello Java  The above example has been used to print Hello Java text on the screen.
  • 4.  Java is an object-oriented programming language with its runtime environment. It is a combination of features of C and C++ with some essential additional concepts. Java is well suited for both standalone and web application development and is designed to provide solutions to most of the problems faced by users of the internet era.
  • 5. WHAT IS JAVA  Java is an object-oriented programming language developed by Sun Microsystems, and it was released in 1995.  James Gosling initially developed Java in Sun Microsystems (which was later merged with Oracle Corporation).  Java is a set of features of C and C++. It has obtained its format from C, and OOP features from C++.  Java programs are platform independent which means they can be run on any operating system with any processor as long as the Java interpreter is available on that system.  Java code that runs on one platform does not need to be recompiled to run on another platform; it's called write once, run anywhere(WORA).  Java Virtual Machine (JVM) executes Java code, but it has been written in platform-specific languages such as C/C++/ASM, etc. JVM is not written in Java and hence cannot be platform independent, and Java interpreter is a part of JVM.
  • 6. WHERE IS JAVA BEING USED  Earlier Java was only used to design and program small computing devices, but it was later adopted as one of the platform-independent programming languages, and now according to Sun, 3 billion devices run Java.  Java is one of the most important programming languages in today's IT industries.  JSP - In Java, JSP (Java Server Pages) is used to create dynamic web pages, such as in PHP and ASP.  Applets - Applets are another type of Java programs that are implemented on Internet browsers and are always run as part of a web document.  J2EE - Java 2 Enterprise Edition is a platform-independent environment that is a set of different protocols and APIs and is used by various organizations to transfer data between each other.  JavaBeans - This is a set of reusable software components that can be easily used to create new and advanced applications.  Mobile - In addition to the above technology, Java is widely used in mobile devices nowadays, many types of games and applications are being made in Java.
  • 7. TYPES OF JAVA APPLICATION  Web Application - Java is used to create server-side web applications. Currently, Servlet, JSP, Struts, JSF, etc. technologies are used.  Standalone Application - It is also known as the desktop application or window-based application. An application that we need to install on every machine or server such as media player, antivirus, etc. AWT and Swing are used in java for creating standalone applications.  Enterprise Application - An application that is distributed in nature, such as banking applications, etc. It has the advantage of the high-level security, load balancing, and clustering. In Java, EJB is used for creating enterprise applications.  Mobile Application - Java is used to create application software for mobile devices. Currently, Java ME is used for building applications for small devices, and also Java is a programming language for Google Android application development.
  • 8. FEATURES OF JAVA  Object-Oriented - Java supports the features of object-oriented programming. Its object model is simple and easy to expand.  Platform independent - C and C++ are platform dependency languages hence the application programs written in one Operating system cannot run in any other Operating system, but in platform independence language like Java application programs written in one Operating system can able to run on any Operating system.  Simple - Java has included many features of C / C ++, which makes it easy to understand.  Secure - Java provides a wide range of protection from viruses and malicious programs. It ensures that there will be no damage and no security will be broken.  Portable - Java provides us the concept of portability. Running the same program with Java on different platforms is possible.  Robust - During the development of the program, it helps us to find possible mistakes as soon as possible.  Multi-threaded - The multithreading programming feature in Java allows you to write a program that performs several different tasks simultaneously.  Distributed - Java is designed for distributed Internet environments as it manages the TCP/IP protocol.  Popular Java Editors
  • 9. POPULAR JAVA EDITOR  Notepad - On Windows machine, you can use any simple text editor like Notepad (Recommended for this tutorial), TextPad.  Netbeans - is a Java IDE that is open source and free which can be downloaded from http://www.netbeans.org/index.html  Eclipse - is also a java IDE developed by the Eclipse open source community and can be downloaded from http://www.eclipse.org/
  • 10. EVOLUTION OF JAVA  The development of each programming language is based on a fact: there is a need to solve a problem that was not resolved by previous programming languages. Early programmers had to choose different programming languages, usually for various tasks, such as a specific language for a type of field. A certain language was sufficient to solve the problems of its field but was not able to solve the problems of other fields. For example, Fortran could have been used to write efficient programs for scientific problems, but it was not good for system code. Similarly, Basic was easy to understand but was not robust to write big programs; While the assembly language was powerful for writing efficient programs, but it was not easy to remember and execution.
  • 11.  Programming languages such as Cobol, Fortran do not have structural principles. They use the Goto statement to control the flow of the program. Therefore, programs using this type of code are made up of many jumps and conditional statements that make it difficult to understand.  Therefore, C was invented in 1970, to replace the assembly language and to create a structured, effective and high-level language. The development of C was the result of the development process started with BCPL by Dennis Ritchie. BCPL is an old language developed by Martin Richard. Ken Thompson developed a language called B, which was influenced by BCPL.  C is a processor-oriented programming language; it is easy to execute and understand. C became quite famous at that time because it was reliable, simple and easy to use.
  • 12.  Though C was quite efficient and successful programming language, the complexity of the program was seeking more efficient language to solve problems. When we write a program in C, it has a limit, such as a maximum of 25000 lines of code, beyond which it can not handle the complexity. But writing and managing large programs was a demand at that time. So a new concept came.  C++ came with object-oriented programming features. C++ is the extension of C language which has been used extensively. It is a powerful modern language that includes the power and simplicity of C and the characteristics of OOP. C++ provides more functional software benefits than C.  C ++ with OOP became quite famous but then a new problem arose, to control the software on different machines, a separate compiler is required for that CPU. But building a C++ compiler was quite expensive. Therefore, an efficient and easy solution was needed, and this requirement became the reason for the creation of Java, which is a portable and platform-independent language.
  • 13. HISTORY OF JAVA TECHNOLOGY  History of Java programming language is usually associated with origin predates of the web. James Gosling, Patrick Naughton, Chris Warth, Mike Sheridan and Ed Frank initiated the Java language project in June 1991. The idea was to develop a language which was platform-independent and which could create embedded software for consumer electronic devices. It took 18 months to develop and had an initial name as Oak which was renamed to Java in 1995, due to copyright issues. 
  • 14. JAVA VERSION RELEASE HISTORY  Version Released on  JDK1.023 Jan 1996  JDK1.119 Feb 1997  J2SE 1.28 Dec 1998  J2SE 1.38 May 2000  J2SE 1.46 Feb 2002  J2SE 5.030 Sept 2004  Java SE 611 Dec 2006  Java SE 7.028 July 2011  Java SE 8.018 March 2014  Java SE 9.0Sept 2017  Java SE 10 (18.3)2018
  • 15. JAVA PROGRAM STRUCTURE  It is necessary to know the exact structure of the Java program, and this lesson contains a detailed description of it. This lesson is essential for you before proceeding to learn more advanced lessons of Java programming. Here, in this chapter, you will study the structure of the Java program. Such as how to create a simple Java program and what its different sections mean.
  • 16. BASIC STRUCTURE OF JAVA PROGRAM  A Java program involves the following sections:  Documentation Section  Package Statement  Import Statements  Interface Statement  Class Definition  Main Method Class  Main Method Definition
  • 17. Section Description Documentation Section You can write a comment in this section. Comments are beneficial for the programmer because they help them understand the code. These are optional, but we suggest you use them because they are useful to understand the operation of the program, so you must write comments within the program. Package statement You can create a package with any name. A package is a group of classes that are defined by a name. That is, if you want to declare many classes within one element, then you can declare it within a package. It is an optional part of the program, i.e., if you do not want to declare any package, then there will be no problem with it, and you will not get any errors. Here, the package is a keyword that tells the compiler that package has been created.It is declared as: package package_name;
  • 18. Import statements This line indicates that if you want to use a class of another package, then you can do this by importing it directly into your program. Example:import calc.add; Interface statement Interfaces are like a class that includes a group of method declarations. It's an optional section and can be used when programmers want to implement multiple inheritances within a program. Class Definition A Java program may contain several class definitions. Classes are the main and essential elements of any Java program. Main Method Class Every Java stand-alone program requires the main method as the starting point of the program. This is an essential part of a Java program. There may be many classes in a Java program, and only one class defines the main method. Methods contain data type declaration and executable statements.
  • 19. SIMPLE JAVA PROGRAM //Name of this file will be "Hello.java" public class Hello { /* Writes the words "Hello Java" on the screen */ public static void main(String[] args) { System.out.println("Hello Java"); } } Program output: Hello Java
  • 20. public class Hello •This creates a class called Hello. •All class names must start with a capital letter. •The public word means that it is accessible from any other classes. /* Comments */ The compiler ignores comment block. Comment can be used anywhere in the program to add info about program or code block, which will be helpful for developers to understand the existing code in the future easily. Braces Two curly brackets {...} are used to group all the commands, so it is known that the commands belong to that class or method.
  • 21. public static void main •When the main method is declared public, it means that it can also be used by code outside of its class, due to which the main method is declared public. •The word static used when we want to access a method without creating its object, as we call the main method, before creating any class objects. •The word void indicates that a method does not return a value. main() is declared as void because it does not return a value. •main is a method; this is a starting point of a Java program. You will notice that the main method code has been moved to some spaces left. It is called indentation which used to make a program easier to read and understand. String[] args It is an array where each element of it is a string, which has been named as "args". If your Java program is run through the console, you can pass input parameter, and main() method takes it as input. System.out.println(); This statement is used to print text on the screen as output, where system is a predefined class, and out is an object of the PrintWriter class defined in the system. The method println prints the text on the screen with a new line. You can also use print()method
  • 22. DIFFERENCE OF JAVA C CPP C CPP JAVA Language Procedural Object oriented Pure object Oriented Header file Stdio.h Iostream.h conio.h Java does not support any header file Platform Dependant Dependant Independent Pointers Support Support Does not Support Operator overloading Not used Used Not used Multiple Inheritance Not used Used Instead of this we use Interface Translator Compiler Compiler Compiler and interpreter Web Application Not used Not used Internet programming like Frame,Applet
  • 23. C CPP JAVA Operator Dot operator Dot Operator Dot Operator Package Not Create Not Create Create own Package Program #include<stdio.h> //header file for standard input and output main() //ma in method { clrscr(); //clear the screen printf(“welcome”); // print the message getch(); //get the character } #include<iostream.h > //header file necessary for input output stream #include<conio.h> //headerfile for console input output main() //main method { clrscr(); //clear the screen cout<<”welcome”; / /cout is used for output getch(); //get the character } class main //program always start with class because of pure object oriented language { public static void main(String aa[]) //main method { System.out.print(“we lcome”); //print the message } }
  • 24. JAVA SUPPORT SYSTEM & ENVIRONMENT  The Java Virtual Machine is called JVM, is an abstract computing machine or virtual mac hine interface that drives the java code.  When we talk about the Java applications, then it works only on those machines which have JVM.
  • 25. WHAT IS JVM  JVM i.e., Java Virtual Machine.  JVM is the engine that drives the Java code.  Mostly in other Programming Languages, compiler produce code for a particular system but Java compiler produce Bytecode for a Java Virtual Machine.  When we compile a Java program, then bytecode is generated. Bytecode is the source code that can be used to run on any platform.  Bytecode is an intermediary language between Java source and the host system.  It is the medium which compiles Java code to bytecode which gets interpreted on a different machine and hence it makes it Platform/Operating system independent.
  • 26. JVM'S WORK CAN BE EXPLAINED IN THE FOLLOWING MANNER.  Reading Bytecode.  Verifying bytecode.  Linking the code with the library.  Diagram of JVM  JVM generates a .class(Bytecode) file, and that file can be run in any OS, but JVM should have in OS because JVM is platform dependent.
  • 27. PLATFORM INDEPENDENT  Java is called platform independent because of Java Virtual Machine. As different computers with the different operating system have their JVM, when we submit a .class file to any operating system, JVM interprets the bytecode into machine level language.  JVM is the main component of Java architecture, and it is the part of the JRE (Java Runtime Environment).  A program of JVM is written in C Programming Language, and JVM is Operating System dependent.  JVM is responsible for allocating the necessary memory needed by the Java program.  JVM is responsible for deallocating memory space.