SlideShare ist ein Scribd-Unternehmen logo
1 von 25
Programming in JAVA
BY
N.RUBA
ASST.PROF/DEPT. OF CA,
BON SECOURS COLLEGE FOR WOMEN,
THANJAVUR.
1
 Overview of Java Technology
 Java as a programming language
 Java as a platform
 Short history of the development of java
 Java as a new paradigm in programming
 Features of Java
 Comparing java and other languages
 Applications and Applets
CHAPTER-2
Introduction to Java Programming
2
 A program is a series of instructions that are carried out by a computer.
 Application programming is a programming process that is aimed at
developing an application.(e.g banking, railway .,etc)
 Systems programming- is the activity of writing, amending or extending
the operating system, which is a program that runs on the computer
hardware in order to allow other applications to be run.
Introduction 3
 Java is a general-purpose high-level object oriented programming language that
provides the following characteristics:
 Simple
 Object oriented
 Interpreted•
 Architecture-neutral
 Platform independent
 Multithread
 Dynamic
 High-performance
 Distributed
 Robust
 Secure.
Java as a programming language
4
 A programming language requires either a compiler or an interpreter to
translate a code written in high-level programming language (source code)
into its machine language (objectcode) equivalent.
 But, to run a Java program, Java uses a combination of compiler and
interpreter.
 The Java compiler translates the Java program into an intermediate code called
Java byte code.
 A Java interpreter is used to run the compiled Java byte code. This allows Java
programs to run on different platforms.
 A compiled Java byte code can be executed on any computer platform on
which the Java interpreter is installed.
 For each type of computer, a different Java interpreter is required to interpret
the Java byte code.
5
 Java is a strongly typed language. That means that every variable
(or expression) has a type associated with it and the type is
known at the time of compilation.
 In Java, data type conversions do not take place
implicitly.
 There are three kinds of Java program:
 Applications These are stand-alone programs that run on a
computer.
 Applets These are programs that run on a web browser.
Appletviewer is provided to ensure that these programs run
without a web browser.
 Servlets These are programs that run at the server side

6
JAVA as a compiler and Interpreter
Object code
Java Byte
code
interpreter
Java Source
code
Compiler
7
 A software and hardware environment in which a program runs is referred
to as a platform.
 Java platform that is compatible and executes on platforms based on
different hardwares.
 Java platform consists of
 Java Virtual Machine(JVM)
 Receives bytecode files and translates them into machine language(object code)
instructions.
 E.g Unix, linux & windows
 Java Applications Programming Interface(JavaAPI)
 Collection of software components
 API grouped in the form of packages
Java as a platform 8
 Java is a result of efforts of programmers in the early 1990s to develop a portable,
secure and scalable language to be used for communication between electronic
devices.
 A team of programmers led by James Gosling of Sun microsystems developed the first
version of Java called OAK.
 Java language was meant for programming the embedded systems in consumer
electronic devices
 Since the Oak trademark was already registered with some other organization, Sun
Microsystems renamed the language Java, in January 1995.
 During the period when Oak was being developed, the computer world witnessed the
emergence of the Internet. As Internet usage became widespread, the need for a
portable,secure programming language increased.
 Java fit the bill perfectly. Initially developed for use on different electronic devices, the
language was later adapted for Internet programming, Java met all the requirements
specified for web-based applications as it can be used to writeplatform-independent
code.
History of development of Java 9
 In 1995, Sun Microsystems released the first version of the Java Development Kit (JDK)and HotJava, a
Java-enabled browser.
 HotJava was capable of running Java applicationsin the form of Java Applets embedded in web pages, a
feature since taken up by browsers from Microsoft and Netscape. Java is often described as the World
Wide Web (www) programming language.
 From the second half of the 1990s, the popularity of Java increased considerably. An important
consequence of the evolution of Java is that it has grown into a full-scale development system.
 capable of being used for developing large applications that exist outside of the web (Internet)
environment that is, all kinds of program that run on a PC), including those that make extensive use of
networking to enable communication between programs.
 Sun Microsystems are now working to further refine and develop Java language.
In addition,they are also working on other Java tools and applications, Prominent among these are
thefollowing:
 Java Beans--the Java object component technology
 JavaServer-a complete web server application written in Java, supporting serviets.•
 JDBC-Java Database Connectivity, providing a Java-based interface to SQL databases.
 Java Workshop a Java programming environment for developing Java programs which isitself
written in Java.
 To get the latest updates on other Java tools and applications, readers can refer to the website of
Sun Microsystems-http://www.sun.com.
10
There are a number of other factors that are attributed to the rise in popularity of Java.
These include the following
 Familiarity of Java as a programming language to users of other popular languages,
notably C++ and Smalltalk: due to this factor, users find it simple and easy to relate
and comprehend.
 The Java development kit is offered free of cost
 This factor allows potential users to try out language with minimal start-up cost
 Its availability: Java is offered as freely downloadable software from the Sun
Microsystems website
 The software is also available on other websites
 Finally, its timing: Java gained popularity as it emerged at the right time when the
Internet was in its nascent stage and was all set to grow in popularity
Java as a new paradigm in programming
11
Features of Java
It is simple, it is highly robust, platform independent and portable
 Java is simple and Object Oriented Language
 Java is highly secure
 Allows to develop highly reliable software applications.
 Provides compile time checking and run time checking.
 Java makes memory management extremely simple
12
 Java compiler generates a byte code.
 Bytecode-special format
 Java byte code written in hexadecimal characters
 Byte code is completely platform- independent, only the interpreter and a few
native libraries need to be ported to get java run on a new computer or OS.
 The architectural –neutral and portable language platform of java is known as JVM-
Java Virtual Machine.
 Java shows a high performance
 Java is interpreted, threaded and dynamic
 Providing multi threading capability
 Multithreading in Java is a process of executing multiple
threads simultaneously.
 A thread is a lightweight sub-process, the smallest unit of processing.
Multiprocessing and multithreading, both are used to achieve multitasking.
13
 Java is dynamically linked
 Does not have an explicit link space.
 Java source code is divided into .java files
 Compiler complies these into .class files
 Other features of java – no pointers, all memory access is trusted
automatic memory allocation and deallocation
14
Comparing Java and other Languages
 Java is similar to C and C++, but is strongly typed
 Java is dynamically linked
 Java is case sensitive
 Java does not support pointer
 Java allows single inheritance
 Multiple inheritance can be achieved in java through interfaces
 Java is compiled and interpreted language
15
Applications and Applets
 Java program are compiled into applet or application
 Application are stand-alone program executed by virtual machine
 Applets are intended to be loaded into and interpreted by a browser, such
as Netscape or Internet explorer
 A byte code cannot be modified by a programmer
16
Java Applet
 Applet is a special type of program that is embedded in the webpage to generate the
dynamic content. It runs inside the browser and works at client side.
Advantage of Applet
 There are many advantages of applet. They are as follows:
 It works at client side so less response time.
 Secured
 It can be executed by browsers running under many platforms, including Linux, Windows,
Mac Os etc.
Drawback of Applet
 Plugin is required at client browser to execute applet.
How to run an Applet?
 There are two ways to run an applet
 By html file.
 By appletViewer tool (for testing purpose).
17
example of Applet by html file:
To execute the applet by html file, create an applet and compile it. After that create an
html file and place the applet code in html file. Now click the html file.
//First.java
import java.applet.Applet;
import java.awt.Graphics;
public class First extends Applet{
public void paint(Graphics g){
g.drawString("welcome",150,150);
}
}
Note: class must be public because its object is created by Java Plugin software that
resides on the browser.
18
myapplet.html
<html>
<body>
<applet code="First.class" width="300" height="300">
</applet>
</body>
</html>
 To execute the applet by html file, create an applet and compile it. After that create an html
file and place the applet code in html file. Now click the html file.
19
Simple example of Applet by appletviewer tool:
To execute the applet by appletviewer tool, create an applet that contains applet tag in comment and
compile it. After that run it by: appletviewer First.java. Now Html file is not required but it is for testing
purpose only.
//First.java
import java.applet.Applet;
import java.awt.Graphics;
public class First extends Applet{
public void paint(Graphics g){
g.drawString("welcome to applet",150,150);
}
}
/*
<applet code="First.class" width="300" height="300">
</applet>
*/
20
 To execute the applet by appletviewer tool, write in command prompt:
 c:>javac First.java
 c:>appletviewer First.java
21
 Special features of java program
 Access specifier
 Constructors
 Static
 The method main()
 The signature of the main method is
 Public staticvoid main(String args[])
22
Step 1:
Write a program on the notepad and save it with .java (for
example, DemoFile.java) extension.
class Demofile
{
public static void main(String args[]) {
System.out.println("Hello!");
System.out.println("Java");
}
}
23
Step 2:
Open Command Prompt.
Step 3:
Set the directory in which the .java file is saved. In our case, the .java
is saved in C:demo.
Step 4:
Use the javac command to compile the Java program. It generates a
.class file in the same folder. It also shows an error if any.
javac Demofile.java
step 5:
Use the following command to run the Java program:
c:> cd demo
c:> demo> javac Demofile.Java
c:> java Demofile
output:
Hello! Java
24
Thank you
25

Weitere ähnliche Inhalte

Was ist angesagt?

Software environment
Software environmentSoftware environment
Software environmentKinnudj Amee
 
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
 
(Ebook pdf) java programming language basics
(Ebook pdf)   java programming language basics(Ebook pdf)   java programming language basics
(Ebook pdf) java programming language basicsRaffaella D'angelo
 
A Comparison of .NET Framework vs. Java Virtual Machine
A Comparison of .NET Framework vs. Java Virtual MachineA Comparison of .NET Framework vs. Java Virtual Machine
A Comparison of .NET Framework vs. Java Virtual MachineAbdelrahman Hosny
 
Structure programming – Java Programming – Theory
Structure programming – Java Programming – TheoryStructure programming – Java Programming – Theory
Structure programming – Java Programming – TheoryOXUS 20
 
Presentación rs232 java
Presentación rs232 javaPresentación rs232 java
Presentación rs232 javaJohn Rojas
 
Java (Part 2) unit 1
Java (Part 2) unit 1Java (Part 2) unit 1
Java (Part 2) unit 1SURBHI SAROHA
 
Core Java
Core JavaCore Java
Core JavaNA
 

Was ist angesagt? (19)

Software environment
Software environmentSoftware environment
Software environment
 
Java Programming Basics
Java Programming BasicsJava Programming Basics
Java Programming Basics
 
Software requirement
Software requirementSoftware requirement
Software requirement
 
perl-java
perl-javaperl-java
perl-java
 
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 ...
 
Features of java
Features of javaFeatures of java
Features of java
 
Ch2
Ch2Ch2
Ch2
 
(Ebook pdf) java programming language basics
(Ebook pdf)   java programming language basics(Ebook pdf)   java programming language basics
(Ebook pdf) java programming language basics
 
A Comparison of .NET Framework vs. Java Virtual Machine
A Comparison of .NET Framework vs. Java Virtual MachineA Comparison of .NET Framework vs. Java Virtual Machine
A Comparison of .NET Framework vs. Java Virtual Machine
 
Java Programming
Java ProgrammingJava Programming
Java Programming
 
Java
JavaJava
Java
 
Structure programming – Java Programming – Theory
Structure programming – Java Programming – TheoryStructure programming – Java Programming – Theory
Structure programming – Java Programming – Theory
 
Java features
Java featuresJava features
Java features
 
Presentación rs232 java
Presentación rs232 javaPresentación rs232 java
Presentación rs232 java
 
Java (Part 2) unit 1
Java (Part 2) unit 1Java (Part 2) unit 1
Java (Part 2) unit 1
 
J introtojava1-pdf
J introtojava1-pdfJ introtojava1-pdf
J introtojava1-pdf
 
Core Java
Core JavaCore Java
Core Java
 
JAVA First Day
JAVA First DayJAVA First Day
JAVA First Day
 
JAVA Program Examples
JAVA Program ExamplesJAVA Program Examples
JAVA Program Examples
 

Ähnlich wie Features of java unit 1

Chapter 1 introduction to java technology
Chapter 1 introduction to java technologyChapter 1 introduction to java technology
Chapter 1 introduction to java technologysshhzap
 
JAVA ALL 5 MODULE NOTES.pptx
JAVA ALL 5 MODULE NOTES.pptxJAVA ALL 5 MODULE NOTES.pptx
JAVA ALL 5 MODULE NOTES.pptxDrPreethiD1
 
Core Java Slides
Core Java SlidesCore Java Slides
Core Java SlidesVinit Vyas
 
Java & J2EE Struts with Hibernate Framework
Java & J2EE Struts with Hibernate FrameworkJava & J2EE Struts with Hibernate Framework
Java & J2EE Struts with Hibernate FrameworkMohit Belwal
 
java introduction.docx
java introduction.docxjava introduction.docx
java introduction.docxvikasbagra9887
 
JAVA PROGRAMMING-Unit I - Final PPT.pptx
JAVA PROGRAMMING-Unit I - Final PPT.pptxJAVA PROGRAMMING-Unit I - Final PPT.pptx
JAVA PROGRAMMING-Unit I - Final PPT.pptxSuganthiDPSGRKCW
 
0f0cef_1dac552af56c4338ab0672859199e693.pdf
0f0cef_1dac552af56c4338ab0672859199e693.pdf0f0cef_1dac552af56c4338ab0672859199e693.pdf
0f0cef_1dac552af56c4338ab0672859199e693.pdfDeepakChaudhriAmbali
 
Notes of java first unit
Notes of java first unitNotes of java first unit
Notes of java first unitgowher172236
 
Introduction to Java Programming.pdf
Introduction to Java Programming.pdfIntroduction to Java Programming.pdf
Introduction to Java Programming.pdfAdiseshaK
 
Java Evolution-2.pdf
Java Evolution-2.pdfJava Evolution-2.pdf
Java Evolution-2.pdfkumari36
 
MODULE_1_The History and Evolution of Java.pptx
MODULE_1_The History and Evolution of Java.pptxMODULE_1_The History and Evolution of Java.pptx
MODULE_1_The History and Evolution of Java.pptxVeerannaKotagi1
 
Java Tutorial to Learn Java Programming
Java Tutorial to Learn Java ProgrammingJava Tutorial to Learn Java Programming
Java Tutorial to Learn Java Programmingbusiness Corporate
 
TechSearchWeb Tutorials.pdf
TechSearchWeb Tutorials.pdfTechSearchWeb Tutorials.pdf
TechSearchWeb Tutorials.pdfTechSearchWeb
 

Ähnlich wie Features of java unit 1 (20)

Chapter 1 introduction to java technology
Chapter 1 introduction to java technologyChapter 1 introduction to java technology
Chapter 1 introduction to java technology
 
JAVA ALL 5 MODULE NOTES.pptx
JAVA ALL 5 MODULE NOTES.pptxJAVA ALL 5 MODULE NOTES.pptx
JAVA ALL 5 MODULE NOTES.pptx
 
Core Java Slides
Core Java SlidesCore Java Slides
Core Java Slides
 
Java & J2EE Struts with Hibernate Framework
Java & J2EE Struts with Hibernate FrameworkJava & J2EE Struts with Hibernate Framework
Java & J2EE Struts with Hibernate Framework
 
Core java slides
Core java slidesCore java slides
Core java slides
 
java introduction.docx
java introduction.docxjava introduction.docx
java introduction.docx
 
Java presentation
Java presentationJava presentation
Java presentation
 
Unit1 JAVA.pptx
Unit1 JAVA.pptxUnit1 JAVA.pptx
Unit1 JAVA.pptx
 
Java features
Java  features Java  features
Java features
 
JAVA PROGRAMMING-Unit I - Final PPT.pptx
JAVA PROGRAMMING-Unit I - Final PPT.pptxJAVA PROGRAMMING-Unit I - Final PPT.pptx
JAVA PROGRAMMING-Unit I - Final PPT.pptx
 
Core Java-1 (1).pdf
Core Java-1 (1).pdfCore Java-1 (1).pdf
Core Java-1 (1).pdf
 
0f0cef_1dac552af56c4338ab0672859199e693.pdf
0f0cef_1dac552af56c4338ab0672859199e693.pdf0f0cef_1dac552af56c4338ab0672859199e693.pdf
0f0cef_1dac552af56c4338ab0672859199e693.pdf
 
Notes of java first unit
Notes of java first unitNotes of java first unit
Notes of java first unit
 
JAVA FEATURES
JAVA FEATURESJAVA FEATURES
JAVA FEATURES
 
Introduction to Java Programming.pdf
Introduction to Java Programming.pdfIntroduction to Java Programming.pdf
Introduction to Java Programming.pdf
 
Java Evolution-2.pdf
Java Evolution-2.pdfJava Evolution-2.pdf
Java Evolution-2.pdf
 
MODULE_1_The History and Evolution of Java.pptx
MODULE_1_The History and Evolution of Java.pptxMODULE_1_The History and Evolution of Java.pptx
MODULE_1_The History and Evolution of Java.pptx
 
Java Tutorial to Learn Java Programming
Java Tutorial to Learn Java ProgrammingJava Tutorial to Learn Java Programming
Java Tutorial to Learn Java Programming
 
TechSearchWeb Tutorials.pdf
TechSearchWeb Tutorials.pdfTechSearchWeb Tutorials.pdf
TechSearchWeb Tutorials.pdf
 
Java
JavaJava
Java
 

Mehr von RubaNagarajan

Computer graphics-CRT.pptx
Computer graphics-CRT.pptxComputer graphics-CRT.pptx
Computer graphics-CRT.pptxRubaNagarajan
 
Matrix representation- CG.pptx
Matrix representation- CG.pptxMatrix representation- CG.pptx
Matrix representation- CG.pptxRubaNagarajan
 
Personality development.pptx
Personality development.pptxPersonality development.pptx
Personality development.pptxRubaNagarajan
 
TRANSFORMATION-CG.pptx
TRANSFORMATION-CG.pptxTRANSFORMATION-CG.pptx
TRANSFORMATION-CG.pptxRubaNagarajan
 
dda algorithm-cg.pptx
dda algorithm-cg.pptxdda algorithm-cg.pptx
dda algorithm-cg.pptxRubaNagarajan
 
line attributes.pptx
line attributes.pptxline attributes.pptx
line attributes.pptxRubaNagarajan
 
Java files and io streams
Java files and io streamsJava files and io streams
Java files and io streamsRubaNagarajan
 
Java -Exception handlingunit-iv
Java -Exception handlingunit-ivJava -Exception handlingunit-iv
Java -Exception handlingunit-ivRubaNagarajan
 
Introduction to Java -unit-1
Introduction to Java -unit-1Introduction to Java -unit-1
Introduction to Java -unit-1RubaNagarajan
 
Working principles of internet
Working principles of internetWorking principles of internet
Working principles of internetRubaNagarajan
 
Virtualization in cloud computing
Virtualization in cloud computingVirtualization in cloud computing
Virtualization in cloud computingRubaNagarajan
 
Cloud computing technology
Cloud computing technologyCloud computing technology
Cloud computing technologyRubaNagarajan
 

Mehr von RubaNagarajan (19)

Computer graphics-CRT.pptx
Computer graphics-CRT.pptxComputer graphics-CRT.pptx
Computer graphics-CRT.pptx
 
Matrix representation- CG.pptx
Matrix representation- CG.pptxMatrix representation- CG.pptx
Matrix representation- CG.pptx
 
Personality development.pptx
Personality development.pptxPersonality development.pptx
Personality development.pptx
 
TRANSFORMATION-CG.pptx
TRANSFORMATION-CG.pptxTRANSFORMATION-CG.pptx
TRANSFORMATION-CG.pptx
 
dda algorithm-cg.pptx
dda algorithm-cg.pptxdda algorithm-cg.pptx
dda algorithm-cg.pptx
 
line attributes.pptx
line attributes.pptxline attributes.pptx
line attributes.pptx
 
Java files and io streams
Java files and io streamsJava files and io streams
Java files and io streams
 
Java -Exception handlingunit-iv
Java -Exception handlingunit-ivJava -Exception handlingunit-iv
Java -Exception handlingunit-iv
 
Java Programming
Java Programming Java Programming
Java Programming
 
Introduction to Java -unit-1
Introduction to Java -unit-1Introduction to Java -unit-1
Introduction to Java -unit-1
 
Constructors in C++
Constructors in C++Constructors in C++
Constructors in C++
 
Risks in cc
Risks in ccRisks in cc
Risks in cc
 
Dreamweaver
DreamweaverDreamweaver
Dreamweaver
 
Working principles of internet
Working principles of internetWorking principles of internet
Working principles of internet
 
Coreldraw
CoreldrawCoreldraw
Coreldraw
 
C programming
C programmingC programming
C programming
 
OPERATING SYSTEM
OPERATING SYSTEMOPERATING SYSTEM
OPERATING SYSTEM
 
Virtualization in cloud computing
Virtualization in cloud computingVirtualization in cloud computing
Virtualization in cloud computing
 
Cloud computing technology
Cloud computing technologyCloud computing technology
Cloud computing technology
 

Kürzlich hochgeladen

Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDThiyagu K
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...EduSkills OECD
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxRamakrishna Reddy Bijjam
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingTechSoup
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxAreebaZafar22
 
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-II
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-IIFood Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-II
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-IIShubhangi Sonawane
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfagholdier
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104misteraugie
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactPECB
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhikauryashika82
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...Nguyen Thanh Tu Collection
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdfQucHHunhnh
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.pptRamjanShidvankar
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfciinovamais
 
psychiatric nursing HISTORY COLLECTION .docx
psychiatric  nursing HISTORY  COLLECTION  .docxpsychiatric  nursing HISTORY  COLLECTION  .docx
psychiatric nursing HISTORY COLLECTION .docxPoojaSen20
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeThiyagu K
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdfQucHHunhnh
 

Kürzlich hochgeladen (20)

Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SD
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
Asian American Pacific Islander Month DDSD 2024.pptx
Asian American Pacific Islander Month DDSD 2024.pptxAsian American Pacific Islander Month DDSD 2024.pptx
Asian American Pacific Islander Month DDSD 2024.pptx
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-II
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-IIFood Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-II
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-II
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
psychiatric nursing HISTORY COLLECTION .docx
psychiatric  nursing HISTORY  COLLECTION  .docxpsychiatric  nursing HISTORY  COLLECTION  .docx
psychiatric nursing HISTORY COLLECTION .docx
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 

Features of java unit 1

  • 1. Programming in JAVA BY N.RUBA ASST.PROF/DEPT. OF CA, BON SECOURS COLLEGE FOR WOMEN, THANJAVUR. 1
  • 2.  Overview of Java Technology  Java as a programming language  Java as a platform  Short history of the development of java  Java as a new paradigm in programming  Features of Java  Comparing java and other languages  Applications and Applets CHAPTER-2 Introduction to Java Programming 2
  • 3.  A program is a series of instructions that are carried out by a computer.  Application programming is a programming process that is aimed at developing an application.(e.g banking, railway .,etc)  Systems programming- is the activity of writing, amending or extending the operating system, which is a program that runs on the computer hardware in order to allow other applications to be run. Introduction 3
  • 4.  Java is a general-purpose high-level object oriented programming language that provides the following characteristics:  Simple  Object oriented  Interpreted•  Architecture-neutral  Platform independent  Multithread  Dynamic  High-performance  Distributed  Robust  Secure. Java as a programming language 4
  • 5.  A programming language requires either a compiler or an interpreter to translate a code written in high-level programming language (source code) into its machine language (objectcode) equivalent.  But, to run a Java program, Java uses a combination of compiler and interpreter.  The Java compiler translates the Java program into an intermediate code called Java byte code.  A Java interpreter is used to run the compiled Java byte code. This allows Java programs to run on different platforms.  A compiled Java byte code can be executed on any computer platform on which the Java interpreter is installed.  For each type of computer, a different Java interpreter is required to interpret the Java byte code. 5
  • 6.  Java is a strongly typed language. That means that every variable (or expression) has a type associated with it and the type is known at the time of compilation.  In Java, data type conversions do not take place implicitly.  There are three kinds of Java program:  Applications These are stand-alone programs that run on a computer.  Applets These are programs that run on a web browser. Appletviewer is provided to ensure that these programs run without a web browser.  Servlets These are programs that run at the server side  6
  • 7. JAVA as a compiler and Interpreter Object code Java Byte code interpreter Java Source code Compiler 7
  • 8.  A software and hardware environment in which a program runs is referred to as a platform.  Java platform that is compatible and executes on platforms based on different hardwares.  Java platform consists of  Java Virtual Machine(JVM)  Receives bytecode files and translates them into machine language(object code) instructions.  E.g Unix, linux & windows  Java Applications Programming Interface(JavaAPI)  Collection of software components  API grouped in the form of packages Java as a platform 8
  • 9.  Java is a result of efforts of programmers in the early 1990s to develop a portable, secure and scalable language to be used for communication between electronic devices.  A team of programmers led by James Gosling of Sun microsystems developed the first version of Java called OAK.  Java language was meant for programming the embedded systems in consumer electronic devices  Since the Oak trademark was already registered with some other organization, Sun Microsystems renamed the language Java, in January 1995.  During the period when Oak was being developed, the computer world witnessed the emergence of the Internet. As Internet usage became widespread, the need for a portable,secure programming language increased.  Java fit the bill perfectly. Initially developed for use on different electronic devices, the language was later adapted for Internet programming, Java met all the requirements specified for web-based applications as it can be used to writeplatform-independent code. History of development of Java 9
  • 10.  In 1995, Sun Microsystems released the first version of the Java Development Kit (JDK)and HotJava, a Java-enabled browser.  HotJava was capable of running Java applicationsin the form of Java Applets embedded in web pages, a feature since taken up by browsers from Microsoft and Netscape. Java is often described as the World Wide Web (www) programming language.  From the second half of the 1990s, the popularity of Java increased considerably. An important consequence of the evolution of Java is that it has grown into a full-scale development system.  capable of being used for developing large applications that exist outside of the web (Internet) environment that is, all kinds of program that run on a PC), including those that make extensive use of networking to enable communication between programs.  Sun Microsystems are now working to further refine and develop Java language. In addition,they are also working on other Java tools and applications, Prominent among these are thefollowing:  Java Beans--the Java object component technology  JavaServer-a complete web server application written in Java, supporting serviets.•  JDBC-Java Database Connectivity, providing a Java-based interface to SQL databases.  Java Workshop a Java programming environment for developing Java programs which isitself written in Java.  To get the latest updates on other Java tools and applications, readers can refer to the website of Sun Microsystems-http://www.sun.com. 10
  • 11. There are a number of other factors that are attributed to the rise in popularity of Java. These include the following  Familiarity of Java as a programming language to users of other popular languages, notably C++ and Smalltalk: due to this factor, users find it simple and easy to relate and comprehend.  The Java development kit is offered free of cost  This factor allows potential users to try out language with minimal start-up cost  Its availability: Java is offered as freely downloadable software from the Sun Microsystems website  The software is also available on other websites  Finally, its timing: Java gained popularity as it emerged at the right time when the Internet was in its nascent stage and was all set to grow in popularity Java as a new paradigm in programming 11
  • 12. Features of Java It is simple, it is highly robust, platform independent and portable  Java is simple and Object Oriented Language  Java is highly secure  Allows to develop highly reliable software applications.  Provides compile time checking and run time checking.  Java makes memory management extremely simple 12
  • 13.  Java compiler generates a byte code.  Bytecode-special format  Java byte code written in hexadecimal characters  Byte code is completely platform- independent, only the interpreter and a few native libraries need to be ported to get java run on a new computer or OS.  The architectural –neutral and portable language platform of java is known as JVM- Java Virtual Machine.  Java shows a high performance  Java is interpreted, threaded and dynamic  Providing multi threading capability  Multithreading in Java is a process of executing multiple threads simultaneously.  A thread is a lightweight sub-process, the smallest unit of processing. Multiprocessing and multithreading, both are used to achieve multitasking. 13
  • 14.  Java is dynamically linked  Does not have an explicit link space.  Java source code is divided into .java files  Compiler complies these into .class files  Other features of java – no pointers, all memory access is trusted automatic memory allocation and deallocation 14
  • 15. Comparing Java and other Languages  Java is similar to C and C++, but is strongly typed  Java is dynamically linked  Java is case sensitive  Java does not support pointer  Java allows single inheritance  Multiple inheritance can be achieved in java through interfaces  Java is compiled and interpreted language 15
  • 16. Applications and Applets  Java program are compiled into applet or application  Application are stand-alone program executed by virtual machine  Applets are intended to be loaded into and interpreted by a browser, such as Netscape or Internet explorer  A byte code cannot be modified by a programmer 16
  • 17. Java Applet  Applet is a special type of program that is embedded in the webpage to generate the dynamic content. It runs inside the browser and works at client side. Advantage of Applet  There are many advantages of applet. They are as follows:  It works at client side so less response time.  Secured  It can be executed by browsers running under many platforms, including Linux, Windows, Mac Os etc. Drawback of Applet  Plugin is required at client browser to execute applet. How to run an Applet?  There are two ways to run an applet  By html file.  By appletViewer tool (for testing purpose). 17
  • 18. example of Applet by html file: To execute the applet by html file, create an applet and compile it. After that create an html file and place the applet code in html file. Now click the html file. //First.java import java.applet.Applet; import java.awt.Graphics; public class First extends Applet{ public void paint(Graphics g){ g.drawString("welcome",150,150); } } Note: class must be public because its object is created by Java Plugin software that resides on the browser. 18
  • 19. myapplet.html <html> <body> <applet code="First.class" width="300" height="300"> </applet> </body> </html>  To execute the applet by html file, create an applet and compile it. After that create an html file and place the applet code in html file. Now click the html file. 19
  • 20. Simple example of Applet by appletviewer tool: To execute the applet by appletviewer tool, create an applet that contains applet tag in comment and compile it. After that run it by: appletviewer First.java. Now Html file is not required but it is for testing purpose only. //First.java import java.applet.Applet; import java.awt.Graphics; public class First extends Applet{ public void paint(Graphics g){ g.drawString("welcome to applet",150,150); } } /* <applet code="First.class" width="300" height="300"> </applet> */ 20
  • 21.  To execute the applet by appletviewer tool, write in command prompt:  c:>javac First.java  c:>appletviewer First.java 21
  • 22.  Special features of java program  Access specifier  Constructors  Static  The method main()  The signature of the main method is  Public staticvoid main(String args[]) 22
  • 23. Step 1: Write a program on the notepad and save it with .java (for example, DemoFile.java) extension. class Demofile { public static void main(String args[]) { System.out.println("Hello!"); System.out.println("Java"); } } 23
  • 24. Step 2: Open Command Prompt. Step 3: Set the directory in which the .java file is saved. In our case, the .java is saved in C:demo. Step 4: Use the javac command to compile the Java program. It generates a .class file in the same folder. It also shows an error if any. javac Demofile.java step 5: Use the following command to run the Java program: c:> cd demo c:> demo> javac Demofile.Java c:> java Demofile output: Hello! Java 24