SlideShare uma empresa Scribd logo
1 de 43
https://www.facebook.com/Oxus20
oxus20@gmail.com
Structure
programming
Java
Programming –
Theory
Chapter 1 Introduction
to Computers,
Programs, and Java
Author: Parwiz Danyar
Objectives
» To review computer basics, programs, and operating
systems
» To explore the relationship between Java and the World
Wide Web
» To distinguish the terms API, IDE, and JDK
» To write a simple Java program
» To display output on the console
» To explain the basic syntax of a Java program
» To create, compile, and run Java programs
» (GUI) To display output using the JOptionPane output
dialog boxes
https://www.facebook.com/Oxus20
What is a Computer?
A computer consists of a CPU, memory, hard disk, floppy disk,
monitor, printer, and communication devices.
CPU
e.g., Disk, CD,
and Tape
Input
Devices
e.g., Keyboard,
Mouse
e.g., Monitor,
Printer
Communication
Devices
e.g., Modem,
and NIC
Storage
Devices
Memory
Output
Devices
Bus
https://www.facebook.com/Oxus20
CPU
The central processing unit (CPU) is the brain of a computer. It
retrieves instructions from memory and executes them. The CPU
speed is measured in megahertz (MHz), with 1 megahertz equaling 1
million pulses per second. The speed of the CPU has been improved
continuously. If you buy a PC now, you can get an Intel Pentium 4
Processor at 3 gigahertz or more (1 gigahertz is 1000 megahertz).
CPU
e.g., Disk, CD,
and Tape
Input
Devices
e.g., Keyboard,
Mouse
e.g., Monitor,
Printer
Communication
Devices
e.g., Modem,
and NIC
Storage
Devices
Memory
Output
Devices
Bus
https://www.facebook.com/Oxus20
Memory
Memory is to store data and program instructions for CPU to
execute. A memory unit is an ordered sequence of bytes, each holds
eight bits. A program and its data must be brought to memory before
they can be executed.
CPU
e.g., Disk, CD,
and Tape
Input
Devices
e.g., Keyboard,
Mouse
e.g., Monitor,
Printer
Communication
Devices
e.g., Modem,
and NIC
Storage
Devices
Memory
Output
Devices
Bus
https://www.facebook.com/Oxus20
Storage Devices
Memory is volatile, because information is lost when the power is
off. Programs and data are permanently stored on storage devices
and are moved to memory when the computer actually uses them.
There are three main types of storage devices: Disk drives (hard
disks and floppy disks), CD drives (CD-R and CD-RW), and Tape
drives.
CPU
e.g., Disk, CD,
and Tape
Input
Devices
e.g., Keyboard,
Mouse
e.g., Monitor,
Printer
Communication
Devices
e.g., Modem,
and NIC
Storage
Devices
Memory
Output
Devices
Bus
https://www.facebook.com/Oxus20
Output Devices: Monitor
The monitor displays information (text and graphics). The resolution
and dot pitch determine the quality of the display.
CPU
e.g., Disk, CD,
and Tape
Input
Devices
e.g., Keyboard,
Mouse
e.g., Monitor,
Printer
Communication
Devices
e.g., Modem,
and NIC
Storage
Devices
Memory
Output
Devices
Bus
https://www.facebook.com/Oxus20
Communication Devices
A regular modem uses a phone line and can transfer data in a speed up to
56,000 bps (bits per second). A DSL (digital subscriber line) also uses a
phone line and can transfer data in a speed 20 times faster than a regular
modem. A cable modem uses the TV cable line maintained by the cable
company. A cable modem is as fast as a DSL. Network interface card
(NIC) is a device to connect a computer to a local area network (LAN).
The LAN is commonly used in business, universities, and government
organizations. A typical type of NIC, called 10BaseT, can transfer data at
10 mbps (million bits per second).
CPU
e.g., Disk, CD,
and Tape
Input
Devices
e.g., Keyboard,
Mouse
e.g., Monitor,
Printer
Communication
Devices
e.g., Modem,
and NIC
Storage
Devices
Memory
Output
Devices
Bus
https://www.facebook.com/Oxus20
Programs
Computer programs, known as software, are instructions
to the computer.
You tell a computer what to do through programs. Without
programs, a computer is an empty machine. Computers do
not understand human languages, so you need to use
computer languages to communicate with them.
Programs are written using programming languages.
https://www.facebook.com/Oxus20
Programming Languages
Machine Language Assembly Language High-Level Language
Machine language is a set of primitive instructions
built into every computer. The instructions are in
the form of binary code, so you have to enter binary
codes for various instructions. Program with native
machine language is a tedious process. Moreover
the programs are highly difficult to read and
modify. For example, to add two numbers, you
might write an instruction in binary like this:
1101101010011010
https://www.facebook.com/Oxus20
Programming Languages
Machine Language Assembly Language High-Level Language
Assembly languages were developed to make programming
easy. Since the computer cannot understand assembly
language, however, a program called assembler is used to
convert assembly language programs into machine code.
For example, to add two numbers, you might write an
instruction in assembly code like this:
ADDF3 R1, R2, R3
…
ADDF3 R1, R2, R3
…
Assembly Source File
Assembler …
1101101010011010
…
Machine Code File
https://www.facebook.com/Oxus20
Programming Languages
Machine Language Assembly Language High-Level Language
The high-level languages are English-like and easy to
learn and program. For example, the following is a high-
level language statement that computes the area of a circle
with radius 5:
area = 5 * 5 * 3.1415;
https://www.facebook.com/Oxus20
Popular High-Level Languages
»COBOL (COmmon Business Oriented Language)
»FORTRAN (FORmula TRANslation)
»BASIC (Beginner All-purpose Symbolic Instructional Code)
»Pascal (named for Blaise Pascal)
»Ada (named for Ada Lovelace)
»C (whose developer designed B first)
»Visual Basic (Basic-like visual language developed by Microsoft)
»Delphi (Pascal-like visual language developed by Borland)
»C++ (an object-oriented language, based on C)
»C# (a Java-like language developed by Microsoft)
»Java (We use it during the course)
https://www.facebook.com/Oxus20
Compiling Source Code
A program written in a high-level language is called a
source program. Since a computer cannot understand a
source program. Program called a compiler is used to
translate the source program into a machine language
program called an object program. The object program
is often then linked with other supporting library code
before the object can be executed on the machine.
CompilerSource File Machine-language
File
Linker Executable File
Library Code
https://www.facebook.com/Oxus20
Why Java?
The answer is that Java enables users to develop and
deploy applications on the Internet for servers, desktop
computers, and small hand-held devices. The future of
computing is being profoundly influenced by the Internet,
and Java promises to remain a big part of that future. Java
is the Internet programming language.
Java is a general purpose programming language.
Java is the Internet programming language.
https://www.facebook.com/Oxus20
Java, Web, and Beyond
» Java can be used to develop Web
applications.
» Java Applets
» Java Web Applications
» Java can also be used to develop applications
for hand-held devices such as Palm and cell
phones
https://www.facebook.com/Oxus20
Examples of Java’s Versatility (Applets)
https://www.facebook.com/Oxus20
PDA and Cell Phone
PDA
Cell Phone
https://www.facebook.com/Oxus20
Java’s History
» James Gosling and Sun Microsystems
» Oak
» Java, May 20, 1995, Sun World
» HotJava
˃ The first Java-enabled Web browser
» Early History Website:
http://java.sun.com/features/1998/05/birthday.html
https://www.facebook.com/Oxus20
Characteristics of Java
» Java Is Simple
» Java Is Object-Oriented
» Java Is Distributed
» Java Is Interpreted
» Java Is Robust ( full power and strong)
» Java Is Secure
» Java Is Architecture-Neutral
» Java Is Portable
» Java's Performance
» Java Is Multithreaded
» Java Is Dynamic
https://www.facebook.com/Oxus20
JDK: Java Development kit
» A package of software distributed by Sun
Microsystems for Java developers that
implements the basic set of tools needed to
write, test and debug Java applications and
applets.
https://www.facebook.com/Oxus20
JDK Versions
» JDK 1.02 (1995)
» JDK 1.1 (1996)
» JDK 1.2 (1998)
» JDK 1.3 (2000)
» JDK 1.4 (2002)
» JDK 1.5 (2004) a. k. a. JDK 5 or Java 5
» JDK 1.6 (2006) a. k. a. JDK 6 or Java 6
» JDK 1.7 (possibly 2010) a. k. a. JDK 7 or Java 7
https://www.facebook.com/Oxus20
JDK Editions
» Java Standard Edition (J2SE)
˃ J2SE can be used to develop client-side standalone
applications or applets.
» Java Enterprise Edition (J2EE)
˃ J2EE can be used to develop server-side applications such as
Java servlets and Java ServerPages.
» Java Micro Edition (J2ME).
˃ J2ME can be used to develop applications for mobile devices
such as cell phones.
https://www.facebook.com/Oxus20
Popular Java IDEs
» NetBeans Open Source by Sun
» Eclipse Open Source by IBM
https://www.facebook.com/Oxus20
A Simple Java Program
//This program prints Welcome to Java!
public class Welcome {
public static void main(String[] args) {
System.out.println("Welcome to first
Java program");
}
}
Result
Listing 1.1
https://www.facebook.com/Oxus20
Creating and Editing Using
NotePad
To use NotePad, type
notepad Welcome.java
from the DOS prompt.
https://www.facebook.com/Oxus20
Creating and Editing Using
WordPad
To use WordPad, type
write Welcome.java
from the DOS prompt.
https://www.facebook.com/Oxus20
//This program prints Welcome to Java!
public class Welcome {
public static void main(String[] args) {
System.out.println("Welcome to Java!");
}
}
Trace a Program Execution
Enter main method
https://www.facebook.com/Oxus20
//This program prints Welcome to Java!
public class Welcome {
public static void main(String[] args) {
System.out.println("Welcome to Java!");
}
}
Trace a Program Execution
Execute statement
https://www.facebook.com/Oxus20
//This program prints Welcome to Java!
public class Welcome {
public static void main(String[] args) {
System.out.println("Welcome to Java!");
}
}
Trace a Program Execution
print a message to the
console
https://www.facebook.com/Oxus20
Anatomy of a Java Program
» Comments
» Reserved words
» Modifiers
» Statements
» Blocks
» Classes
» Methods
» The main method
https://www.facebook.com/Oxus20
Comments
Line comment: A line comment is preceded by two
slashes (//) in a line.
Paragraph comment: A paragraph comment is
enclosed between /* and */ in one or multiple lines.
javadoc comment: javadoc comments begin with
/** and end with */. They are used for
documenting classes, data, and methods. They
can be extracted into an HTML file using JDK's
javadoc command.
Three types of comments in Java.
https://www.facebook.com/Oxus20
Reserved Words
Reserved words or keywords are words that have a
specific meaning to the compiler and cannot be
used for other purposes in the program. For
example, when the compiler sees the word class, it
understands that the word after class is the name
for the class. Other reserved words in Listing 1.1 are
public, static, and void. Their use will be introduced
later in the book.
https://www.facebook.com/Oxus20
Modifiers
Java uses certain reserved words called modifiers
that specify the properties of the data, methods,
and classes and how they can be used. Examples of
modifiers are public and static. Other modifiers are
private, final, abstract, and protected. A public
datum, method, or class can be accessed by other
programs. A private datum or method cannot be
accessed by other programs.
https://www.facebook.com/Oxus20
Statements
A statement represents an action or a sequence of
actions. The statement System.out.println("Welcome
to Java!") in the program in Listing 1.1 is a statement
to display the greeting "Welcome to Java!" Every
statement in Java ends with a semicolon (;).
https://www.facebook.com/Oxus20
Blocks
A pair of braces in a program forms a block that
groups components of a program.
public class Test {
public static void main(String[] args) {
System.out.println("Welcome to Java!");
}
}
Class block
Method block
https://www.facebook.com/Oxus20
Classes
The class is the essential Java construct. A class is a
template or blueprint for objects. To program in Java,
you must understand classes and be able to write and
use them. The mystery of the class will continue to be
unveiled throughout this book. For now, though,
understand that a program is defined by using one or
more classes.
https://www.facebook.com/Oxus20
Methods
What is System.out.println? It is a method: a
collection of statements that performs a sequence of
operations to display a message on the console. It can
be used even without fully understanding the details
of how it works. It is used by invoking a statement
with a string argument. The string argument is
enclosed within parentheses. In this case, the
argument is "Welcome to Java!" You can call the same
println method with a different argument to print a
different message.
https://www.facebook.com/Oxus20
main Method
The main method provides the control of program
flow. The Java interpreter executes the application by
invoking the main method.
The main method looks like this:
public static void main(String[] args) {
// Statements;
}
https://www.facebook.com/Oxus20
Displaying Text in a Message
Dialog Box
you can use the showMessageDialog method in the
JOptionPane class. JOptionPane is one of the many
predefined classes in the Java system, which can be
reused rather than “reinventing the wheel.”
https://www.facebook.com/Oxus20
The showMessageDialog
Method
JOptionPane.showMessageDialog(null,
"Welcome to Java!",
"Display Message",
JOptionPane.INFORMATION_MESSAGE);
https://www.facebook.com/Oxus20
Two Ways to Invoke the Method
There are several ways to use the
showMessageDialog method. For the time being, all
you need to know are two ways to invoke it.
One is to use a statement as shown in the example:
JOptionPane.showMessageDialog(null, x,
y, JOptionPane.INFORMATION_MESSAGE);
where x is a string for the text to be displayed, and y
is a string for the title of the message dialog box.
The other is to use a statement like this:
JOptionPane.showMessageDialog(null, x);
where x is a string for the text to be displayed.
https://www.facebook.com/Oxus20
END
https://www.facebook.com/Oxus20
43

Mais conteúdo relacionado

Mais procurados

Presentation on Core java
Presentation on Core javaPresentation on Core java
Presentation on Core javamahir jain
 
Java for Recruiters
Java for RecruitersJava for Recruiters
Java for Recruitersph7 -
 
Core Java
Core JavaCore Java
Core JavaNA
 
Chapter 1 introduction to java technology
Chapter 1 introduction to java technologyChapter 1 introduction to java technology
Chapter 1 introduction to java technologysshhzap
 
1 Introduction To Java Technology
1 Introduction To Java Technology 1 Introduction To Java Technology
1 Introduction To Java Technology dM Technologies
 
Introduction to java (revised)
Introduction to java (revised)Introduction to java (revised)
Introduction to java (revised)Sujit Majety
 
basic core java up to operator
basic core java up to operatorbasic core java up to operator
basic core java up to operatorkamal kotecha
 
Introduction to java
Introduction to javaIntroduction to java
Introduction to javajayc8586
 
Training on Core java | PPT Presentation | Shravan Sanidhya
Training on Core java | PPT Presentation | Shravan SanidhyaTraining on Core java | PPT Presentation | Shravan Sanidhya
Training on Core java | PPT Presentation | Shravan SanidhyaShravan Sanidhya
 
Fundamentals of JAVA
Fundamentals of JAVAFundamentals of JAVA
Fundamentals of JAVAKUNAL GADHIA
 

Mais procurados (20)

Java Programming
Java ProgrammingJava Programming
Java Programming
 
Presentation on Core java
Presentation on Core javaPresentation on Core java
Presentation on Core java
 
Java for Recruiters
Java for RecruitersJava for Recruiters
Java for Recruiters
 
Java unit 1
Java unit 1Java unit 1
Java unit 1
 
Core Java
Core JavaCore Java
Core Java
 
Programming in Java
Programming in JavaProgramming in Java
Programming in Java
 
Core Java
Core JavaCore Java
Core Java
 
Chapter 1 introduction to java technology
Chapter 1 introduction to java technologyChapter 1 introduction to java technology
Chapter 1 introduction to java technology
 
Introduction to java technology
Introduction to java technologyIntroduction to java technology
Introduction to java technology
 
Core java slides
Core java slidesCore java slides
Core java slides
 
1 Introduction To Java Technology
1 Introduction To Java Technology 1 Introduction To Java Technology
1 Introduction To Java Technology
 
Core java
Core javaCore java
Core java
 
Introduction to java (revised)
Introduction to java (revised)Introduction to java (revised)
Introduction to java (revised)
 
basic core java up to operator
basic core java up to operatorbasic core java up to operator
basic core java up to operator
 
Introduction to java
Introduction to javaIntroduction to java
Introduction to java
 
Training on Core java | PPT Presentation | Shravan Sanidhya
Training on Core java | PPT Presentation | Shravan SanidhyaTraining on Core java | PPT Presentation | Shravan Sanidhya
Training on Core java | PPT Presentation | Shravan Sanidhya
 
core java
core javacore java
core java
 
Java basics notes
Java basics notesJava basics notes
Java basics notes
 
Java notes
Java notesJava notes
Java notes
 
Fundamentals of JAVA
Fundamentals of JAVAFundamentals of JAVA
Fundamentals of JAVA
 

Destaque

Create Splash Screen with Java Step by Step
Create Splash Screen with Java Step by StepCreate Splash Screen with Java Step by Step
Create Splash Screen with Java Step by StepOXUS 20
 
Create Splash Screen with Java Step by Step
Create Splash Screen with Java Step by StepCreate Splash Screen with Java Step by Step
Create Splash Screen with Java Step by StepAbdul Rahman Sherzad
 
Everything about Object Oriented Programming
Everything about Object Oriented ProgrammingEverything about Object Oriented Programming
Everything about Object Oriented ProgrammingAbdul Rahman Sherzad
 
Java Regular Expression PART I
Java Regular Expression PART IJava Regular Expression PART I
Java Regular Expression PART IOXUS 20
 
PHP Basic and Fundamental Questions and Answers with Detail Explanation
PHP Basic and Fundamental Questions and Answers with Detail ExplanationPHP Basic and Fundamental Questions and Answers with Detail Explanation
PHP Basic and Fundamental Questions and Answers with Detail ExplanationOXUS 20
 
Java Virtual Keyboard Using Robot, Toolkit and JToggleButton Classes
Java Virtual Keyboard Using Robot, Toolkit and JToggleButton ClassesJava Virtual Keyboard Using Robot, Toolkit and JToggleButton Classes
Java Virtual Keyboard Using Robot, Toolkit and JToggleButton ClassesOXUS 20
 
Conditional Statement
Conditional Statement Conditional Statement
Conditional Statement OXUS 20
 
TKP Java Notes for Teaching Kids Programming
TKP Java Notes for Teaching Kids ProgrammingTKP Java Notes for Teaching Kids Programming
TKP Java Notes for Teaching Kids ProgrammingLynn Langit
 
Java Unicode with Cool GUI Examples
Java Unicode with Cool GUI ExamplesJava Unicode with Cool GUI Examples
Java Unicode with Cool GUI ExamplesOXUS 20
 
Java Applet and Graphics
Java Applet and GraphicsJava Applet and Graphics
Java Applet and GraphicsOXUS 20
 
Java Regular Expression PART II
Java Regular Expression PART IIJava Regular Expression PART II
Java Regular Expression PART IIOXUS 20
 
Fal-e-Hafez (Omens of Hafez) Cards in Persian using Java
Fal-e-Hafez (Omens of Hafez) Cards in Persian using JavaFal-e-Hafez (Omens of Hafez) Cards in Persian using Java
Fal-e-Hafez (Omens of Hafez) Cards in Persian using JavaOXUS 20
 
Object Oriented Concept Static vs. Non Static
Object Oriented Concept Static vs. Non StaticObject Oriented Concept Static vs. Non Static
Object Oriented Concept Static vs. Non StaticOXUS 20
 
Java Guessing Game Number Tutorial
Java Guessing Game Number TutorialJava Guessing Game Number Tutorial
Java Guessing Game Number TutorialOXUS 20
 
Web Design and Development Life Cycle and Technologies
Web Design and Development Life Cycle and TechnologiesWeb Design and Development Life Cycle and Technologies
Web Design and Development Life Cycle and TechnologiesOXUS 20
 
Note - Java Remote Debug
Note - Java Remote DebugNote - Java Remote Debug
Note - Java Remote Debugboyw165
 
Everything about Database JOINS and Relationships
Everything about Database JOINS and RelationshipsEverything about Database JOINS and Relationships
Everything about Database JOINS and RelationshipsOXUS 20
 
Core java notes with examples
Core java notes with examplesCore java notes with examples
Core java notes with examplesbindur87
 
Java Unicode with Live GUI Examples
Java Unicode with Live GUI ExamplesJava Unicode with Live GUI Examples
Java Unicode with Live GUI ExamplesAbdul Rahman Sherzad
 
Java Virtual Keyboard Using Robot, Toolkit and JToggleButton Classes
Java Virtual Keyboard Using Robot, Toolkit and JToggleButton ClassesJava Virtual Keyboard Using Robot, Toolkit and JToggleButton Classes
Java Virtual Keyboard Using Robot, Toolkit and JToggleButton ClassesAbdul Rahman Sherzad
 

Destaque (20)

Create Splash Screen with Java Step by Step
Create Splash Screen with Java Step by StepCreate Splash Screen with Java Step by Step
Create Splash Screen with Java Step by Step
 
Create Splash Screen with Java Step by Step
Create Splash Screen with Java Step by StepCreate Splash Screen with Java Step by Step
Create Splash Screen with Java Step by Step
 
Everything about Object Oriented Programming
Everything about Object Oriented ProgrammingEverything about Object Oriented Programming
Everything about Object Oriented Programming
 
Java Regular Expression PART I
Java Regular Expression PART IJava Regular Expression PART I
Java Regular Expression PART I
 
PHP Basic and Fundamental Questions and Answers with Detail Explanation
PHP Basic and Fundamental Questions and Answers with Detail ExplanationPHP Basic and Fundamental Questions and Answers with Detail Explanation
PHP Basic and Fundamental Questions and Answers with Detail Explanation
 
Java Virtual Keyboard Using Robot, Toolkit and JToggleButton Classes
Java Virtual Keyboard Using Robot, Toolkit and JToggleButton ClassesJava Virtual Keyboard Using Robot, Toolkit and JToggleButton Classes
Java Virtual Keyboard Using Robot, Toolkit and JToggleButton Classes
 
Conditional Statement
Conditional Statement Conditional Statement
Conditional Statement
 
TKP Java Notes for Teaching Kids Programming
TKP Java Notes for Teaching Kids ProgrammingTKP Java Notes for Teaching Kids Programming
TKP Java Notes for Teaching Kids Programming
 
Java Unicode with Cool GUI Examples
Java Unicode with Cool GUI ExamplesJava Unicode with Cool GUI Examples
Java Unicode with Cool GUI Examples
 
Java Applet and Graphics
Java Applet and GraphicsJava Applet and Graphics
Java Applet and Graphics
 
Java Regular Expression PART II
Java Regular Expression PART IIJava Regular Expression PART II
Java Regular Expression PART II
 
Fal-e-Hafez (Omens of Hafez) Cards in Persian using Java
Fal-e-Hafez (Omens of Hafez) Cards in Persian using JavaFal-e-Hafez (Omens of Hafez) Cards in Persian using Java
Fal-e-Hafez (Omens of Hafez) Cards in Persian using Java
 
Object Oriented Concept Static vs. Non Static
Object Oriented Concept Static vs. Non StaticObject Oriented Concept Static vs. Non Static
Object Oriented Concept Static vs. Non Static
 
Java Guessing Game Number Tutorial
Java Guessing Game Number TutorialJava Guessing Game Number Tutorial
Java Guessing Game Number Tutorial
 
Web Design and Development Life Cycle and Technologies
Web Design and Development Life Cycle and TechnologiesWeb Design and Development Life Cycle and Technologies
Web Design and Development Life Cycle and Technologies
 
Note - Java Remote Debug
Note - Java Remote DebugNote - Java Remote Debug
Note - Java Remote Debug
 
Everything about Database JOINS and Relationships
Everything about Database JOINS and RelationshipsEverything about Database JOINS and Relationships
Everything about Database JOINS and Relationships
 
Core java notes with examples
Core java notes with examplesCore java notes with examples
Core java notes with examples
 
Java Unicode with Live GUI Examples
Java Unicode with Live GUI ExamplesJava Unicode with Live GUI Examples
Java Unicode with Live GUI Examples
 
Java Virtual Keyboard Using Robot, Toolkit and JToggleButton Classes
Java Virtual Keyboard Using Robot, Toolkit and JToggleButton ClassesJava Virtual Keyboard Using Robot, Toolkit and JToggleButton Classes
Java Virtual Keyboard Using Robot, Toolkit and JToggleButton Classes
 

Semelhante a Structure programming – Java Programming – Theory

Chapter 01 Java Programming Basic Java IDE JAVA INTELLIEJ
Chapter 01 Java Programming Basic Java IDE JAVA INTELLIEJChapter 01 Java Programming Basic Java IDE JAVA INTELLIEJ
Chapter 01 Java Programming Basic Java IDE JAVA INTELLIEJIMPERIALXGAMING
 
Introduction.pptx
Introduction.pptxIntroduction.pptx
Introduction.pptxSUDHAKAR S
 
Itroduction about java
Itroduction about javaItroduction about java
Itroduction about javasrmohan06
 
Introduction to Computer Programming (general background)
Introduction to Computer Programming (general background)Introduction to Computer Programming (general background)
Introduction to Computer Programming (general background)Chao-Lung Yang
 
intoduction to Computer programming java learn for more chapter contact salma...
intoduction to Computer programming java learn for more chapter contact salma...intoduction to Computer programming java learn for more chapter contact salma...
intoduction to Computer programming java learn for more chapter contact salma...Syed Shah
 
microemulsions microemulsions microemulsions microemulsions
microemulsions microemulsions microemulsions microemulsionsmicroemulsions microemulsions microemulsions microemulsions
microemulsions microemulsions microemulsions microemulsionsAhmadHashlamon
 
01review
01review01review
01reviewIIUM
 
J2ee strutswithhibernate-140121221332-phpapp01
J2ee strutswithhibernate-140121221332-phpapp01J2ee strutswithhibernate-140121221332-phpapp01
J2ee strutswithhibernate-140121221332-phpapp01Jay Palit
 
Introduction to Computers, Programs, and Java
Introduction to Computers, Programs, and JavaIntroduction to Computers, Programs, and Java
Introduction to Computers, Programs, and Javanaimanighat
 
Unit 2 Foc
Unit 2 FocUnit 2 Foc
Unit 2 FocJAYA
 
Java & J2EE Struts with Hibernate Framework
Java & J2EE Struts with Hibernate FrameworkJava & J2EE Struts with Hibernate Framework
Java & J2EE Struts with Hibernate FrameworkMohit Belwal
 
12eb50e2-6ffd-41a0-ac74-d6c77b516b5d-150409094316-conversion-gate01
12eb50e2-6ffd-41a0-ac74-d6c77b516b5d-150409094316-conversion-gate0112eb50e2-6ffd-41a0-ac74-d6c77b516b5d-150409094316-conversion-gate01
12eb50e2-6ffd-41a0-ac74-d6c77b516b5d-150409094316-conversion-gate01Ankush Kumar
 
Computer
ComputerComputer
ComputerCAFE91
 
Intoduction to java
Intoduction to javaIntoduction to java
Intoduction to javajalinder123
 
Dr. Rajeshree Khande :Intoduction to java
Dr. Rajeshree Khande :Intoduction to javaDr. Rajeshree Khande :Intoduction to java
Dr. Rajeshree Khande :Intoduction to javaDrRajeshreeKhande
 
introduction to c language
 introduction to c language introduction to c language
introduction to c languageRai University
 

Semelhante a Structure programming – Java Programming – Theory (20)

Chapter 01 Java Programming Basic Java IDE JAVA INTELLIEJ
Chapter 01 Java Programming Basic Java IDE JAVA INTELLIEJChapter 01 Java Programming Basic Java IDE JAVA INTELLIEJ
Chapter 01 Java Programming Basic Java IDE JAVA INTELLIEJ
 
Glossary
GlossaryGlossary
Glossary
 
Introduction.pptx
Introduction.pptxIntroduction.pptx
Introduction.pptx
 
Itroduction about java
Itroduction about javaItroduction about java
Itroduction about java
 
Introduction to Computer Programming (general background)
Introduction to Computer Programming (general background)Introduction to Computer Programming (general background)
Introduction to Computer Programming (general background)
 
Glossary 2
Glossary 2Glossary 2
Glossary 2
 
intoduction to Computer programming java learn for more chapter contact salma...
intoduction to Computer programming java learn for more chapter contact salma...intoduction to Computer programming java learn for more chapter contact salma...
intoduction to Computer programming java learn for more chapter contact salma...
 
microemulsions microemulsions microemulsions microemulsions
microemulsions microemulsions microemulsions microemulsionsmicroemulsions microemulsions microemulsions microemulsions
microemulsions microemulsions microemulsions microemulsions
 
CISY 105 Chapter 1
CISY 105 Chapter 1CISY 105 Chapter 1
CISY 105 Chapter 1
 
01review
01review01review
01review
 
J2ee strutswithhibernate-140121221332-phpapp01
J2ee strutswithhibernate-140121221332-phpapp01J2ee strutswithhibernate-140121221332-phpapp01
J2ee strutswithhibernate-140121221332-phpapp01
 
Introduction to Computers, Programs, and Java
Introduction to Computers, Programs, and JavaIntroduction to Computers, Programs, and Java
Introduction to Computers, Programs, and Java
 
JAVA CORE
JAVA COREJAVA CORE
JAVA CORE
 
Unit 2 Foc
Unit 2 FocUnit 2 Foc
Unit 2 Foc
 
Java & J2EE Struts with Hibernate Framework
Java & J2EE Struts with Hibernate FrameworkJava & J2EE Struts with Hibernate Framework
Java & J2EE Struts with Hibernate Framework
 
12eb50e2-6ffd-41a0-ac74-d6c77b516b5d-150409094316-conversion-gate01
12eb50e2-6ffd-41a0-ac74-d6c77b516b5d-150409094316-conversion-gate0112eb50e2-6ffd-41a0-ac74-d6c77b516b5d-150409094316-conversion-gate01
12eb50e2-6ffd-41a0-ac74-d6c77b516b5d-150409094316-conversion-gate01
 
Computer
ComputerComputer
Computer
 
Intoduction to java
Intoduction to javaIntoduction to java
Intoduction to java
 
Dr. Rajeshree Khande :Intoduction to java
Dr. Rajeshree Khande :Intoduction to javaDr. Rajeshree Khande :Intoduction to java
Dr. Rajeshree Khande :Intoduction to java
 
introduction to c language
 introduction to c language introduction to c language
introduction to c language
 

Mais de OXUS 20

Java Arrays
Java ArraysJava Arrays
Java ArraysOXUS 20
 
Java Methods
Java MethodsJava Methods
Java MethodsOXUS 20
 
Fundamentals of Database Systems Questions and Answers
Fundamentals of Database Systems Questions and AnswersFundamentals of Database Systems Questions and Answers
Fundamentals of Database Systems Questions and AnswersOXUS 20
 
JAVA GUI PART III
JAVA GUI PART IIIJAVA GUI PART III
JAVA GUI PART IIIOXUS 20
 
Java GUI PART II
Java GUI PART IIJava GUI PART II
Java GUI PART IIOXUS 20
 
JAVA GUI PART I
JAVA GUI PART IJAVA GUI PART I
JAVA GUI PART IOXUS 20
 
JAVA Programming Questions and Answers PART III
JAVA Programming Questions and Answers PART IIIJAVA Programming Questions and Answers PART III
JAVA Programming Questions and Answers PART IIIOXUS 20
 
Object Oriented Programming with Real World Examples
Object Oriented Programming with Real World ExamplesObject Oriented Programming with Real World Examples
Object Oriented Programming with Real World ExamplesOXUS 20
 

Mais de OXUS 20 (8)

Java Arrays
Java ArraysJava Arrays
Java Arrays
 
Java Methods
Java MethodsJava Methods
Java Methods
 
Fundamentals of Database Systems Questions and Answers
Fundamentals of Database Systems Questions and AnswersFundamentals of Database Systems Questions and Answers
Fundamentals of Database Systems Questions and Answers
 
JAVA GUI PART III
JAVA GUI PART IIIJAVA GUI PART III
JAVA GUI PART III
 
Java GUI PART II
Java GUI PART IIJava GUI PART II
Java GUI PART II
 
JAVA GUI PART I
JAVA GUI PART IJAVA GUI PART I
JAVA GUI PART I
 
JAVA Programming Questions and Answers PART III
JAVA Programming Questions and Answers PART IIIJAVA Programming Questions and Answers PART III
JAVA Programming Questions and Answers PART III
 
Object Oriented Programming with Real World Examples
Object Oriented Programming with Real World ExamplesObject Oriented Programming with Real World Examples
Object Oriented Programming with Real World Examples
 

Último

Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsArshad QA
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comFatema Valibhai
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionSolGuruz
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfkalichargn70th171
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesVictorSzoltysek
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...OnePlan Solutions
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...panagenda
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnAmarnathKambale
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxComplianceQuest1
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providermohitmore19
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️Delhi Call girls
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...Health
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...harshavardhanraghave
 
8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech studentsHimanshiGarg82
 
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdfAzure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdfryanfarris8
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️Delhi Call girls
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Modelsaagamshah0812
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVshikhaohhpro
 
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfVishalKumarJha10
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerThousandEyes
 

Último (20)

Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with Precision
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
 
8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students
 
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdfAzure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
 

Structure programming – Java Programming – Theory

  • 2. Objectives » To review computer basics, programs, and operating systems » To explore the relationship between Java and the World Wide Web » To distinguish the terms API, IDE, and JDK » To write a simple Java program » To display output on the console » To explain the basic syntax of a Java program » To create, compile, and run Java programs » (GUI) To display output using the JOptionPane output dialog boxes https://www.facebook.com/Oxus20
  • 3. What is a Computer? A computer consists of a CPU, memory, hard disk, floppy disk, monitor, printer, and communication devices. CPU e.g., Disk, CD, and Tape Input Devices e.g., Keyboard, Mouse e.g., Monitor, Printer Communication Devices e.g., Modem, and NIC Storage Devices Memory Output Devices Bus https://www.facebook.com/Oxus20
  • 4. CPU The central processing unit (CPU) is the brain of a computer. It retrieves instructions from memory and executes them. The CPU speed is measured in megahertz (MHz), with 1 megahertz equaling 1 million pulses per second. The speed of the CPU has been improved continuously. If you buy a PC now, you can get an Intel Pentium 4 Processor at 3 gigahertz or more (1 gigahertz is 1000 megahertz). CPU e.g., Disk, CD, and Tape Input Devices e.g., Keyboard, Mouse e.g., Monitor, Printer Communication Devices e.g., Modem, and NIC Storage Devices Memory Output Devices Bus https://www.facebook.com/Oxus20
  • 5. Memory Memory is to store data and program instructions for CPU to execute. A memory unit is an ordered sequence of bytes, each holds eight bits. A program and its data must be brought to memory before they can be executed. CPU e.g., Disk, CD, and Tape Input Devices e.g., Keyboard, Mouse e.g., Monitor, Printer Communication Devices e.g., Modem, and NIC Storage Devices Memory Output Devices Bus https://www.facebook.com/Oxus20
  • 6. Storage Devices Memory is volatile, because information is lost when the power is off. Programs and data are permanently stored on storage devices and are moved to memory when the computer actually uses them. There are three main types of storage devices: Disk drives (hard disks and floppy disks), CD drives (CD-R and CD-RW), and Tape drives. CPU e.g., Disk, CD, and Tape Input Devices e.g., Keyboard, Mouse e.g., Monitor, Printer Communication Devices e.g., Modem, and NIC Storage Devices Memory Output Devices Bus https://www.facebook.com/Oxus20
  • 7. Output Devices: Monitor The monitor displays information (text and graphics). The resolution and dot pitch determine the quality of the display. CPU e.g., Disk, CD, and Tape Input Devices e.g., Keyboard, Mouse e.g., Monitor, Printer Communication Devices e.g., Modem, and NIC Storage Devices Memory Output Devices Bus https://www.facebook.com/Oxus20
  • 8. Communication Devices A regular modem uses a phone line and can transfer data in a speed up to 56,000 bps (bits per second). A DSL (digital subscriber line) also uses a phone line and can transfer data in a speed 20 times faster than a regular modem. A cable modem uses the TV cable line maintained by the cable company. A cable modem is as fast as a DSL. Network interface card (NIC) is a device to connect a computer to a local area network (LAN). The LAN is commonly used in business, universities, and government organizations. A typical type of NIC, called 10BaseT, can transfer data at 10 mbps (million bits per second). CPU e.g., Disk, CD, and Tape Input Devices e.g., Keyboard, Mouse e.g., Monitor, Printer Communication Devices e.g., Modem, and NIC Storage Devices Memory Output Devices Bus https://www.facebook.com/Oxus20
  • 9. Programs Computer programs, known as software, are instructions to the computer. You tell a computer what to do through programs. Without programs, a computer is an empty machine. Computers do not understand human languages, so you need to use computer languages to communicate with them. Programs are written using programming languages. https://www.facebook.com/Oxus20
  • 10. Programming Languages Machine Language Assembly Language High-Level Language Machine language is a set of primitive instructions built into every computer. The instructions are in the form of binary code, so you have to enter binary codes for various instructions. Program with native machine language is a tedious process. Moreover the programs are highly difficult to read and modify. For example, to add two numbers, you might write an instruction in binary like this: 1101101010011010 https://www.facebook.com/Oxus20
  • 11. Programming Languages Machine Language Assembly Language High-Level Language Assembly languages were developed to make programming easy. Since the computer cannot understand assembly language, however, a program called assembler is used to convert assembly language programs into machine code. For example, to add two numbers, you might write an instruction in assembly code like this: ADDF3 R1, R2, R3 … ADDF3 R1, R2, R3 … Assembly Source File Assembler … 1101101010011010 … Machine Code File https://www.facebook.com/Oxus20
  • 12. Programming Languages Machine Language Assembly Language High-Level Language The high-level languages are English-like and easy to learn and program. For example, the following is a high- level language statement that computes the area of a circle with radius 5: area = 5 * 5 * 3.1415; https://www.facebook.com/Oxus20
  • 13. Popular High-Level Languages »COBOL (COmmon Business Oriented Language) »FORTRAN (FORmula TRANslation) »BASIC (Beginner All-purpose Symbolic Instructional Code) »Pascal (named for Blaise Pascal) »Ada (named for Ada Lovelace) »C (whose developer designed B first) »Visual Basic (Basic-like visual language developed by Microsoft) »Delphi (Pascal-like visual language developed by Borland) »C++ (an object-oriented language, based on C) »C# (a Java-like language developed by Microsoft) »Java (We use it during the course) https://www.facebook.com/Oxus20
  • 14. Compiling Source Code A program written in a high-level language is called a source program. Since a computer cannot understand a source program. Program called a compiler is used to translate the source program into a machine language program called an object program. The object program is often then linked with other supporting library code before the object can be executed on the machine. CompilerSource File Machine-language File Linker Executable File Library Code https://www.facebook.com/Oxus20
  • 15. Why Java? The answer is that Java enables users to develop and deploy applications on the Internet for servers, desktop computers, and small hand-held devices. The future of computing is being profoundly influenced by the Internet, and Java promises to remain a big part of that future. Java is the Internet programming language. Java is a general purpose programming language. Java is the Internet programming language. https://www.facebook.com/Oxus20
  • 16. Java, Web, and Beyond » Java can be used to develop Web applications. » Java Applets » Java Web Applications » Java can also be used to develop applications for hand-held devices such as Palm and cell phones https://www.facebook.com/Oxus20
  • 17. Examples of Java’s Versatility (Applets) https://www.facebook.com/Oxus20
  • 18. PDA and Cell Phone PDA Cell Phone https://www.facebook.com/Oxus20
  • 19. Java’s History » James Gosling and Sun Microsystems » Oak » Java, May 20, 1995, Sun World » HotJava ˃ The first Java-enabled Web browser » Early History Website: http://java.sun.com/features/1998/05/birthday.html https://www.facebook.com/Oxus20
  • 20. Characteristics of Java » Java Is Simple » Java Is Object-Oriented » Java Is Distributed » Java Is Interpreted » Java Is Robust ( full power and strong) » Java Is Secure » Java Is Architecture-Neutral » Java Is Portable » Java's Performance » Java Is Multithreaded » Java Is Dynamic https://www.facebook.com/Oxus20
  • 21. JDK: Java Development kit » A package of software distributed by Sun Microsystems for Java developers that implements the basic set of tools needed to write, test and debug Java applications and applets. https://www.facebook.com/Oxus20
  • 22. JDK Versions » JDK 1.02 (1995) » JDK 1.1 (1996) » JDK 1.2 (1998) » JDK 1.3 (2000) » JDK 1.4 (2002) » JDK 1.5 (2004) a. k. a. JDK 5 or Java 5 » JDK 1.6 (2006) a. k. a. JDK 6 or Java 6 » JDK 1.7 (possibly 2010) a. k. a. JDK 7 or Java 7 https://www.facebook.com/Oxus20
  • 23. JDK Editions » Java Standard Edition (J2SE) ˃ J2SE can be used to develop client-side standalone applications or applets. » Java Enterprise Edition (J2EE) ˃ J2EE can be used to develop server-side applications such as Java servlets and Java ServerPages. » Java Micro Edition (J2ME). ˃ J2ME can be used to develop applications for mobile devices such as cell phones. https://www.facebook.com/Oxus20
  • 24. Popular Java IDEs » NetBeans Open Source by Sun » Eclipse Open Source by IBM https://www.facebook.com/Oxus20
  • 25. A Simple Java Program //This program prints Welcome to Java! public class Welcome { public static void main(String[] args) { System.out.println("Welcome to first Java program"); } } Result Listing 1.1 https://www.facebook.com/Oxus20
  • 26. Creating and Editing Using NotePad To use NotePad, type notepad Welcome.java from the DOS prompt. https://www.facebook.com/Oxus20
  • 27. Creating and Editing Using WordPad To use WordPad, type write Welcome.java from the DOS prompt. https://www.facebook.com/Oxus20
  • 28. //This program prints Welcome to Java! public class Welcome { public static void main(String[] args) { System.out.println("Welcome to Java!"); } } Trace a Program Execution Enter main method https://www.facebook.com/Oxus20
  • 29. //This program prints Welcome to Java! public class Welcome { public static void main(String[] args) { System.out.println("Welcome to Java!"); } } Trace a Program Execution Execute statement https://www.facebook.com/Oxus20
  • 30. //This program prints Welcome to Java! public class Welcome { public static void main(String[] args) { System.out.println("Welcome to Java!"); } } Trace a Program Execution print a message to the console https://www.facebook.com/Oxus20
  • 31. Anatomy of a Java Program » Comments » Reserved words » Modifiers » Statements » Blocks » Classes » Methods » The main method https://www.facebook.com/Oxus20
  • 32. Comments Line comment: A line comment is preceded by two slashes (//) in a line. Paragraph comment: A paragraph comment is enclosed between /* and */ in one or multiple lines. javadoc comment: javadoc comments begin with /** and end with */. They are used for documenting classes, data, and methods. They can be extracted into an HTML file using JDK's javadoc command. Three types of comments in Java. https://www.facebook.com/Oxus20
  • 33. Reserved Words Reserved words or keywords are words that have a specific meaning to the compiler and cannot be used for other purposes in the program. For example, when the compiler sees the word class, it understands that the word after class is the name for the class. Other reserved words in Listing 1.1 are public, static, and void. Their use will be introduced later in the book. https://www.facebook.com/Oxus20
  • 34. Modifiers Java uses certain reserved words called modifiers that specify the properties of the data, methods, and classes and how they can be used. Examples of modifiers are public and static. Other modifiers are private, final, abstract, and protected. A public datum, method, or class can be accessed by other programs. A private datum or method cannot be accessed by other programs. https://www.facebook.com/Oxus20
  • 35. Statements A statement represents an action or a sequence of actions. The statement System.out.println("Welcome to Java!") in the program in Listing 1.1 is a statement to display the greeting "Welcome to Java!" Every statement in Java ends with a semicolon (;). https://www.facebook.com/Oxus20
  • 36. Blocks A pair of braces in a program forms a block that groups components of a program. public class Test { public static void main(String[] args) { System.out.println("Welcome to Java!"); } } Class block Method block https://www.facebook.com/Oxus20
  • 37. Classes The class is the essential Java construct. A class is a template or blueprint for objects. To program in Java, you must understand classes and be able to write and use them. The mystery of the class will continue to be unveiled throughout this book. For now, though, understand that a program is defined by using one or more classes. https://www.facebook.com/Oxus20
  • 38. Methods What is System.out.println? It is a method: a collection of statements that performs a sequence of operations to display a message on the console. It can be used even without fully understanding the details of how it works. It is used by invoking a statement with a string argument. The string argument is enclosed within parentheses. In this case, the argument is "Welcome to Java!" You can call the same println method with a different argument to print a different message. https://www.facebook.com/Oxus20
  • 39. main Method The main method provides the control of program flow. The Java interpreter executes the application by invoking the main method. The main method looks like this: public static void main(String[] args) { // Statements; } https://www.facebook.com/Oxus20
  • 40. Displaying Text in a Message Dialog Box you can use the showMessageDialog method in the JOptionPane class. JOptionPane is one of the many predefined classes in the Java system, which can be reused rather than “reinventing the wheel.” https://www.facebook.com/Oxus20
  • 41. The showMessageDialog Method JOptionPane.showMessageDialog(null, "Welcome to Java!", "Display Message", JOptionPane.INFORMATION_MESSAGE); https://www.facebook.com/Oxus20
  • 42. Two Ways to Invoke the Method There are several ways to use the showMessageDialog method. For the time being, all you need to know are two ways to invoke it. One is to use a statement as shown in the example: JOptionPane.showMessageDialog(null, x, y, JOptionPane.INFORMATION_MESSAGE); where x is a string for the text to be displayed, and y is a string for the title of the message dialog box. The other is to use a statement like this: JOptionPane.showMessageDialog(null, x); where x is a string for the text to be displayed. https://www.facebook.com/Oxus20