Online English Summarizer tool, free and accurate!
What is a Computer?public class Welcome { public static void main(String[] args) { System.out.println("Welcome to Java!"); } } animation print a message to the console Anatomy of a Java Program oComments oReserved words oModifiers oStatements oBlocks oClasses oMethods oThe main method 18 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. 19 Three types of comments in Java. 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. 20 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. 21 Statements o A statement represents an action or a sequence of actions. o 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!"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; Popular High-Level Languages oCOBOL (COmmon Business Oriented Language) oFORTRAN (FORmula TRANslation) oBASIC (Beginner All-purpose Symbolic Instructional Code) oPascal (named for Blaise Pascal) oAda (named for Ada Lovelace) oC (whose developer designed B first) oVisual Basic (Basic-like visual language developed by Microsoft) oDelphi (Pascal-like visual language developed by Borland) oC++ (an object-oriented language, based on C) oC# (a Java-like language developed by Microsoft) oJava (We use it in the book) 9 Operating Systems Operating systems are software systems that make using computers more convenient for users, application developers and system administrators.01001010 01100001 01110110 01100001 00000011 Memory content Memory address Encoding for character 'J' Encoding for character 'a' Encoding for character 'v' Encoding for character 'a' Encoding for number 3 Storage 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 4 Memory is volatile, because information is lost when the power is off.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 How Data is Stored?The main method looks like this: public static void main(String[] args) { // Statements; } 27 The showMessageDialog Method JOptionPane.showMessageDialog(null, "Welcome to Java!", "Display Message", JOptionPane.INFORMATION_MESSAGE);10 Linux Windows Mac OS Android BlackBerry OS Apple's iOS x86 Architecture CPU Memory NIC Card Hard Disk Why Java?11 The answer is that Java enables users to develop and deploy applications on the Internet for servers, desktop computers, and small hand-held devices.public class Welcome { public static void main(String[] args) { System.out.println("Welcome to Java!"); } } Enter main method Trace a Program Execution 16 //This program prints Welcome to Java! public class Welcome { public static void main(String[] args) { System.out.println("Welcome to Java!"); } } Execute statement animation Trace a Program Execution 17 //This program prints Welcome to Java!2 A computer consists of a CPU, memory, hard disk, floppy disk, monitor, printer, and communication devices.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 Programming Languages Machine Language Assembly Language High-Level Language 8 The high-level languages are English-like and easy to learn and program.Data of various kinds, such as numbers, characters, and strings, are encoded as a series of bits (zeros and ones).Computers use zeros and ones because digital devices have two stable states, which are referred to as zero and one by convention.The programmers need not to be concerned about the encoding and decoding of data, which is performed automatically by the system based on the encoding scheme.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.For example, to add two numbers, you might write an instruction in binary like this: 1101101010011010 Programming Languages Machine Language Assembly Language High-Level Language 7 Assembly languages were developed to make programming easy.Operating systems provide services that allow each application to execute safely, efficiently and concurrently (i.e., in parallel) with other applications.The software that contains the core components of the operating system is called the kernel.Popular Java IDEs oNetBeans Open Source by Sun oEclipse Open Source by IBM 12 A Simple Java Program 13 Listing 1.1 Compiling Java Source Code You can port a source program to any machine with appropriate compilers.Programs and data are permanently stored on storage devices and are moved to memory when the computer actually uses them.Java Virtual Machine is a software that interprets Java bytecode.Programs are written using programming languages.3 ...2000 2001 2002 2003 2004 ...
What is a Computer?
2
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
How Data is Stored?
Data of various kinds, such as numbers,
characters, and strings, are encoded as a
series of bits (zeros and ones). Computers
use zeros and ones because digital devices
have two stable states, which are referred
to as zero and one by convention. The
programmers need not to be concerned
about the encoding and decoding of data,
which is performed automatically by the
system based on the encoding scheme. The
encoding scheme varies. For example,
character ‘J’ is represented by 01001010 in
one byte. A small number such as three can
be stored in a single byte. If computer needs
to store a large number that cannot fit into
a single byte, it uses a number of adjacent
bytes. No two data can share or split a same
byte. A byte is the minimum storage unit.
3
.
.
.
2000
2001
2002
2003
2004
.
.
.
01001010
01100001
01110110
01100001
00000011
Memory content
Memory address
Encoding for character ‘J’
Encoding for character ‘a’
Encoding for character ‘v’
Encoding for character ‘a’
Encoding for number 3
Storage 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
4
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.
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.
5
Programming Languages
Machine Language Assembly Language High-Level Language
6
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
Programming Languages
Machine Language Assembly Language High-Level Language
7
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
Programming Languages
Machine Language Assembly Language High-Level Language
8
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;
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 in the book)
9
Operating Systems
Operating systems are software systems that make using
computers more convenient for users, application developers and
system administrators. Operating systems provide services that
allow each application to execute safely, efficiently and concurrently
(i.e., in parallel) with other applications. The software that contains
the core components of the operating system is called the kernel.
10
Linux Windows Mac OS Android BlackBerry
OS
Apple’s iOS
x86 Architecture
CPU Memory
NIC Card Hard Disk
Why Java?
11
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.
Popular Java IDEs
•NetBeans Open Source by Sun
•Eclipse Open Source by IBM
12
A Simple Java Program
13
Listing 1.1
Compiling Java Source Code
You can port a source program to any machine with appropriate
compilers. The source program must be recompiled, however,
because the object program can only run on a specific machine.
Nowadays computers are networked to work together. Java was
designed to run object programs on any platform. With Java, you
write the program once, and compile the source program into a
special type of object code, known as bytecode. The bytecode can
then run on any computer with a Java Virtual Machine, as shown
below. Java Virtual Machine is a software that interprets Java
bytecode.
14
Java Bytecode
Java Virtual
Machine
Any
Computer
Trace a Program Execution
15
//This program prints Welcome to Java!
public class Welcome {
public static void main(String[] args) {
System.out.println("Welcome to Java!");
}
}
Enter main method
Trace a Program Execution
16
//This program prints Welcome to Java!
public class Welcome {
public static void main(String[] args) {
System.out.println("Welcome to Java!");
}
}
Execute statement
animation
Trace a Program Execution
17
//This program prints Welcome to Java!
public class Welcome {
public static void main(String[] args) {
System.out.println("Welcome to Java!");
}
}
animation
print a message to the
console
Anatomy of a Java Program
•Comments
•Reserved words
•Modifiers
•Statements
•Blocks
•Classes
•Methods
•The main method
18
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.
19
Three types of comments in Java.
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.
20
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.
21
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 (;).
22
Blocks
23
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
Classes & methods & objects
24
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;
}
27
The showMessageDialog Method
JOptionPane.showMessageDialog(null,
"Welcome to Java!",
"Display Message",
JOptionPane.INFORMATION_MESSAGE);
Summarize English and Arabic text using the statistical algorithm and sorting sentences based on its importance
You can download the summary result with one of any available formats such as PDF,DOCX and TXT
ٌYou can share the summary link easily, we keep the summary on the website for future reference,except for private summaries.
We are working on adding new features to make summarization more easy and accurate
إعداد د/ معتز محمد نبيل مدرس بقسم الإنتاج الإعلانى يرجع أصل كلمة اتِّ َصال (communication( إلى ...
يعني انا كنت بحكي انا والدكتور بنكون يعني حتى نستفيد نحن منكم بالقطاع الخاص. النظام الدولي كله اليوم...
2. متطلبات مادية تتمثل في توفير وسائل الاتصال التي تساعد على انتقال المعلومات إلى جميع المستويات الإ...
الدرس 1 دعائم القوة الاقتصادية للاتحاد الاوروبي تقوم القوة الاقتصادية الاوروبية على العديد من الدع...
يعد ابن سينا عالِماً، وطبيباً، وفيلسوفاً، وقد عُرِف بلقب أمير الأطباء، وكذلك بأرسطو الإِسلام،[1]واعت...
استخدم الفن البدائي الرموز والأشكال المجردة للتعبير عن الأفكار والمعتقدات، مثل تصوير الآلهة أو القوى...
مقدّمة: تعد مرحلة الطفولة من بين المراحل التي يمر بها الإنسان فهي مرحلة تتميز بالنم و المتسارع الذي ...
تشرح النظرية البنائية (Constructivism) التحرش الجنسي في المجتمع من خلال التركيز على **كيفية بناء وتش...
تتمثل الأهداف الأساسية للحرس السلطاني العُماني في حماية جلالة السلطان، وتأمين محيط القصور والمواقع ا...
يقود PC 188 المعركة في حي مكسور حيث تم تدمير نفق آخر ، بالقرب من ذلك من قبل Golani Kashiri يخضع آخر ...
يُعد علم النفس الإيجابي أحد الفروع الحديثة في علم النفس، وقد تأسس بوصفه توجّهًا علميًا يركز على دراس...
ثالثاً: مجالات وفروع الأنثروبولوجيا :- نتناول في هذا الجزء بعض التعريفات الهامة التي قسمت الأنثروبول...