Языки программирования
<<  Программирование на языке Q Basic Графические возможности языка программирования Delphi  >>
„Java – overview and basics”
„Java – overview and basics”
One compilation Many interpretations
One compilation Many interpretations
Java – compiled and interpreted
Java – compiled and interpreted
The Java platform has two components: The Java Virtual Machine (Java
The Java platform has two components: The Java Virtual Machine (Java
Standard Development Kit Java Runtime Enviroment
Standard Development Kit Java Runtime Enviroment
2. Write HTML file (HelloWorld
2. Write HTML file (HelloWorld
An object is a software bundle of variables and related methods
An object is a software bundle of variables and related methods
An object is a software bundle of variables and related methods
An object is a software bundle of variables and related methods
Message Software objects interact and communicate with each other by
Message Software objects interact and communicate with each other by
The three components of a message: 1) The object to which the message
The three components of a message: 1) The object to which the message
A class is a prototype that defines the variables and the methods
A class is a prototype that defines the variables and the methods
A class is a prototype that defines the variables and the methods
A class is a prototype that defines the variables and the methods
Inheritance Superclass Subclass
Inheritance Superclass Subclass
Variables (6)
Variables (6)
Картинки из презентации «„Java – overview and basics”» к уроку информатики на тему «Языки программирования»

Автор: konrad szumigaj. Чтобы познакомиться с картинкой полного размера, нажмите на её эскиз. Чтобы можно было использовать все картинки для урока информатики, скачайте бесплатно презентацию «„Java – overview and basics”.ppt» со всеми картинками в zip-архиве размером 712 КБ.

„Java – overview and basics”

содержание презентации «„Java – overview and basics”.ppt»
Сл Текст Сл Текст
1„Java – overview and basics”. 34Inventory Interface To work in the
2Literature. English-language sites: inventory program, the bicycle class must
http://java.sun.com agree to this protocol by implementing the
http://www.javaworld.com, interface. When a class implements an
http://www.javareport.com, interface, the class agrees to implement
http://www.jars.com, all the methods defined in the interface.
http://www.gamelon.com, OOP concepts (8). Java – Overview and
http://www.javalobby.com http:// ... Basics.
Polish-language sites: http://www.java.pl 35Interfaces benefits: Capturing
http://www.javasoft.pl similarities among unrelated classes
http://www.webdeveloper.pl. Books: without forcing a class relationship.
„Thinking in Java” Bruce Eckel English Declaring methods that one or more classes
edition: http://www.bruceeckel.com (older are expected to implement. Revealing an
free, newest payable) Polish Edition: object's programming interface without
http://www.helion.pl (payable) ... Java – revealing its class. OOP concepts (9).
Overview and Basics. Java – Overview and Basics.
3Programming language Platform Java 36An object stores its state in
language: Simple Architecture neutral variables. A variable is an item of data
Object oriented Portable Secure. named by an identifier. The variable's
Distributed High performance Interpreted type determines what values it can hold
Multithreaded. What is Java? Java – and what operations can be performed on
Overview and Basics. it. To give a variable a type and a name,
4Brief history. 1990 – suggestion in you write a variable declaration, which
report „Further” concerning creation of generally looks like this: type name A
new object oriented environment 1991 – OAK variable has scope. Variables. Java –
(„Object Application Kernel”) language Overview and Basics.
(James Gosling) 1995 – new language name: 37Variables (2). Every variable must
„Java” 1996 - Netscape compatible with have a data type Java has two categories
Java 1.0. Sun propagates Java 1.0 of data types: primitive and reference A
environment 2001 – Java 1.4.0 – over 2100 variable of primitive type contains a
classes library 2004 – Java 1.5.0 2007 – single value of the appropriate size and
Java 1.6.0. Java – Overview and Basics. format for its type: a number, a
5One compilation Many interpretations. character, or a boolean value Arrays,
Java – compiled and interpreted. Java – classes, and interfaces are reference
Overview and Basics. types. The value of a reference type
6Java – compiled and interpreted. Java variable, in contrast to that of a
– Overview and Basics. primitive type, is a reference to (an
7The Java platform has two components: address of) the value or set of values
The Java Virtual Machine (Java VM) The represented by the variable. A reference
Java Application Programming Interface is called a pointer, or a memory address.
(Java API). Java platform. Java – Overview The Java does not support the explicit use
and Basics. of addresses like other languages do. You
8The essentials: Objects, strings, use the variable's name instead. Java –
threads, numbers, input and output, data Overview and Basics.
structures, system properties, date and 38Primitive data types: Keyword
time, and so on. Applets: The set of Size/Format byte 8-bit short 16-bit int
conventions used by applets. Networking: 32-bit long 64-bit float 32-bit double
URLs, TCP (Transmission Control Protocol), 64-bit char 16-bit boolean true or false.
UDP (User Datagram Protocol) sockets, and The format and size of primitive data
IP (Internet Protocol) addresses. types is independent from the platform on
Internationalization: Help for writing which a program is running ! Variables
programs that can be localized for users (3). Java – Overview and Basics.
worldwide. Programs can automatically 39Variable name: 1) It must be a legal
adapt to specific locales and be displayed identifier. An identifier is an unlimited
in the appropriate language. Java series of Unicode characters that begins
features. Java – Overview and Basics. with a letter. 2 ) It must not be a
9Security: Both low level and high keyword, a boolean literal (true or
level, including electronic signatures, false), or the reserved word null. 3) It
public and private key management, access must be unique within its scope. Variables
control, and certificates. Software (4). Java – Overview and Basics.
components: Known as JavaBeansTM, can plug 40By Convention : Variable names begin
into existing component architectures. with a lowercase letter. Class names begin
Object serialization: Allows lightweight with an uppercase letter. If a variable
persistence and communication via Remote name consists of more than one word, the
Method Invocation (RMI). Java Database words are joined together, and each word
Connectivity (JDBCTM): Provides uniform after the first begins with an uppercase
access to a wide range of relational letter, like this: isVisible. The
databases. Java features (2). Java – underscore character (_) is acceptable
Overview and Basics. anywhere in a name, but by convention is
10Standard Development Kit Java Runtime used only to separate words in constants
Enviroment. SDK & JRE. Java – Overview (because constants are all caps by
and Basics. convention and thus cannot be
111) Copy j2sdk-1_6_0_<version case-delimited). Variables (5). Java –
number>-linux-i586.bin to the directory Overview and Basics.
into which you want to install the Java 2 41Variables (6). A variable's scope is
SDK. (example:) /usr/local/ 2) Run the region of a program within which the
j2sdk-1_6_0_<version variable can be referred to by its simple
number>-linux-i586.bin chmod a+x name. The location of the variable
j2sdk-1_6_0_<version declaration within your program
number>-linux-i586.bin establishes its scope and places it into
./j2sdk-1_6_0_<version one of these four categories: Java –
number>-linux-i586.bin 3) Set Overview and Basics.
enviromental variables to point jdk 42The value of a final variable cannot
installation: export change after it has been initialized. Such
PATH=$PATH:/pathtojdk/bin export variables are similar to constants in
CLASSPATH=$CLASSPATH:/pathtojdk/lib:. other programming languages. To declare a
(example:) export final variable, use the final keyword in
PATH=$PATH:/usr/local/j2sdk-1_4_0_01/bin. the variable declaration before the type:
Linux installation instructions. Java – final int aFinalVar = 0; It is possible
Overview and Basics. declare the local variable and initialize
12Question: What is the first thing you it later (but only once): final int
should check if the interpreter returns blankfinal; . . . blankfinal = 0;
the error: Exception in thread Variables (7). Java – Overview and Basics.
"main" 43Variables (8). Question: Which of the
java.lang.NoClassDefFoundError: following are valid variable names? int
HelloWorldApp.java. Answer: Check your anInt i i1 1 thing1 1thing ONE-HUNDRED
CLASSPATH. Probably current working ONE_HUNDRED. Question: Which of the
directory is not included. Linux following are valid variable names?
installation instructions(2). Java – Answer: int anInt i i1 1 thing1 1thing
Overview and Basics. ONE-HUNDRED ONE_HUNDRED. Java – Overview
13All tools are in pathtojdk/bin/ and Basics.
directory: javac - compiler, java - 44An operator performs a function on
interpreter, javadoc – generator of API one, two, or three operands. Unary
documentation, appletviewer – applet operators (example: ++) (postfix and
browser, jar – tool for jar files jdb - prefix) Binary operators (example: +)
debuggger, Important tools. Java – (infix) Ternary operators ( example: ?:)
Overview and Basics. (infix). Operators. Java – Overview and
14Create a Java source file. A source Basics.
file contains text, written in the Java 45Arithmetic operators: Operators (2).
programming language, that you and other Operator. Use. Description. +. op1 + op2.
programmers can understand. Compile the Adds op1 and op2. -. op1 – op2. Subtracts
source file into a bytecode file. The Java op2 from op1. *. op1 * op2. Multiplies op1
compiler, javac, takes your source file by op2. /. op1 / op2. Divides op1 by op2.
and translates its text into instructions %. op1 % op2. Computes the remainder of
that the Java Virtual Machine (Java VM) dividing op1 by op2. Java – Overview and
can understand. The compiler puts these Basics.
instructions into a bytecode file. Run the 46Arithmetic operators - conversions:
program contained in the bytecode file. Operators (3). Data Type of Result. Data
The Java VM is implemented by a Java Type of Operands. long. Neither operand is
interpreter, java. This interpreter takes a float or a double (integer arithmetic);
your bytecode file and carries out the at least one operand is a long. int.
instructions by translating them into Neither operand is a float or a double
instructions that your computer can (integer arithmetic); neither operand is a
understand. Creating first application. long. double. At least one operand is a
Java – Overview and Basics. double. float. At least one operand is a
15Creating first application. 1. Write float; neither operand is a double. Java –
following code: class HelloWorldApp { Overview and Basics.
public static void main(String[] args) { 47Arithmetic operators : Operators (4).
System.out.println("Hello Operator. Use. Description. +. + op.
World!"); // Display "Hello Promotes op to int if it's a byte, short,
World!" } } 2. Compile it: javac or char. -. – op. Arithmetically negates
HelloWorldApp.java 3. Run the program: op. ++. op ++. Increments op by 1;
java HelloWorldApp. Java – Overview and evaluates to the value of op before it was
Basics. incremented. ++. ++ op. Increments ...
16Write following code: import (after). --. op --. Decrements ...
java.applet.*; import java.awt.*; public (before). --. -- op. Decrements ...
class HelloWorld extends Applet { public (after). Java – Overview and Basics.
void paint(Graphics g) { 48public class SortDemo { public static
g.drawString("Hello world!", 50, void main(String[] args) { int[]
25); // Display "Hello world!" } arrayOfInts = { 32, 87, 3, 589, 12, 8,
}. Creating first applet. Java – Overview 622, 127 }; for (int i =
and Basics. arrayOfInts.length; --i >= 0; ) { for
172. Write HTML file (HelloWorld.html): (int j = 0; j < i; j++) { if
<HTML> <HEAD> <TITLE>The (arrayOfInts[j] > arrayOfInts[j+1]) {
Hello World Applet</TITLE> int temp = arrayOfInts[j]; arrayOfInts[j]
</HEAD> <BODY> <APPLET = arrayOfInts[j+1]; arrayOfInts[j+1] =
CODE="HelloWorld.class" temp; } } } } }. Operators (5). Java –
WIDTH=150 HEIGHT=25> </APPLET> Overview and Basics.
</BODY> </HTML> 3. Compile the 49Relational operators : Operators (6).
source file: javac HelloWorld.java 4. Run Operator. Use. Returns true if. > op1
the program: appletviewer HelloWorld.html. > op2. op1 is greater than op2. >=.
Creating first applet (2). Java – Overview op1 >= op2. op1 is greater than or
and Basics. equal to op2. < op1 < op2. op1 is
18Comments in Java Code. The Java less than op2. <=. op1 <= op2. op1
language supports three kinds of comments: is less than or equal to op2. ==. op1 ==
/* text */ The compiler ignores everything op2. op1 and op2 are equal. !=. op1 !=
from /* to */. /** documentation */ This op2. op1 and op2 are not equal. Java –
indicates a documentation comment The Overview and Basics.
compiler ignores this kind of comment, 50Conditional operators : Operators (7).
just like it ignores comments that use /* Operator. Use. Returns true if. &&
and */. The JDK javadoc tool uses doc op1 && op2. op1 and op2 are both
comments when preparing automatically true, conditionally evaluates op2. ||. op1
generated documentation. // text The || op2. either op1 or op2 is true,
compiler ignores everything from // to the conditionally evaluates op2. ! ! op. op is
end of the line. Java – Overview and false. & op1 & op2. op1 and op2
Basics. are both true, always evaluates op1 and
19Class (template) Instanciation – op2. |. op1 | op2. either op1 or op2 is
creation of an Object Variables Methods. true, always evaluates op1 and op2. ^. op1
Defining a class. Java – Overview and ^ op2. if op1 and op2 are different. Java
Basics. – Overview and Basics.
20public static void main(String[] args) 51Question: 13 >> 1 = ? Answer: 6
To launch an application is necessary to 13(1101) >> 1 = 6 (0110). Shift
implement this method. If no, the similar operators : Operators (8). Operator. Use.
error message is displayed by compiler: In Description. >> op1 >> op2.
class NoMain: void main(String argv[]) is shift bits of op1 right by distance op2.
not defined 2. The main method accepts a << op1 << op2. shift bits of
single argument: an array of elements of op1 left by distance op2. >>> op1
type String. The main method. Java – >>> op2. shift bits of op1 right
Overview and Basics. by distance op2 (unsigned). Java –
21System.out.println(„HelloWorld”); Overview and Basics.
System – class System.out – full name of 52Operator. Use. Operation. & op1
variable out. When the System class is & op2. |. op1 | op2. ^. op1 ^ op2. ~.
loaded into the application, it ~ op. Logical operators : bitwise and.
instantiates PrintStream and assigns the bitwise or. bitwise xor. bitwise
new PrintStream object to the out class complement. Operators (9). Java – Overview
variable PrintStream – type of object out. and Basics.
It has method: println(String); Using an 53public class BitwiseDemo { static
instance method or variable. Java – final int VISIBLE = 1; static final int
Overview and Basics. DRAGGABLE = 2; static final int SELECTABLE
221) import java.applet.Applet; import = 4; static final int EDITABLE = 8; public
java.awt.Graphics; public class HelloWorld static void main(String[] args) { int
extends Applet { public void flags = 0; flags = flags | VISIBLE; flags
paint(Graphics g) { = flags | DRAGGABLE; if ((flags &
g.drawString("Hello world!", 50, VISIBLE) == VISIBLE) { if ((flags &
25); } } public class HelloWorld extends DRAGGABLE) == DRAGGABLE) {
java.applet.Applet { public void System.out.println("Flags are Vis.
paint(java.awt.Graphics g) { and Drag."); } } } }. Operators (10).
g.drawString("Hello world!", 50, Java – Overview and Basics.
25); } }. Importing classes and packages. 54Operator. Use. Equivalent to. +=
Java – Overview and Basics. (arithmetic). op1 += op2. &=
23Packages are used to group classes, (logical). op1 &= op2. >>=
similar to the way libraries are used to (shift). op1 >>= op2. Assignments
group C functions. Every class is in operators (examples): op1 = op1 + op2. op1
package If the source code for a class = op1 & op2. op1 = op1 >> op2.
doesn't have a package statement at the Operators (11). Java – Overview and
top, declaring the package the class is Basics.
in, then the class is in the default 55Other operators: Operators (12).
package. Within a package, all classes can Operator. Description. ?: Shortcut if-else
refer to each other without prefixes. For statement example : a == 1 ? true : false;
example, the java.awt Component class []. Used to declare arrays, create arrays,
refers to the java.awt Graphics class and access array elements. . Used to form
without any prefixes, without importing qualified names. { params }. Delimits a
the Graphics class. Importing classes and comma-separated list of parameters. ( type
packages (2). Java – Overview and Basics. ). Casts (converts) a value to the
24Can't Locate the Compiler javac: specified type. Java – Overview and
Command not found Solution: Modify your Basics.
PATH environment variable so that it 56Operators (13). Other operators: The
includes the directory where the Java new operator creates a new object or a new
compiler lives. Common Compiler problem. array. Example: creating a new Integer
Java – Overview and Basics. object from the Integer class in the
25Can't Find Class Can't find class java.lang package: Integer anInteger = new
HelloWorldApp.class Solution: The argument Integer(10); The instanceof operator tests
to the Java interpreter is the name of the whether its first operand is an instance
class that you want to use, not the of its second. op1 instanceof op2 op1 must
filename (HelloWorldApp instead of be the name of an object and op2 must be
HelloWorldApp.class). Common Interpreter the name of a class. An object is
problem. Java – Overview and Basics. considered to be an instance of a class if
26Java language. Java – Overview and that object directly or indirectly
Basics. descends from that class. Java – Overview
27An object is a software bundle of and Basics.
variables and related methods. Visual 57Operators (14). Operators precedence:
representation of a software object: [] . (params) expr++ expr-- ++expr --expr
Bicycle modeled as a software object: +expr -expr ~ ! new (type)expr * / % + -
Object Oriented Programming (OOP) << >> >>> < >
concepts. Java – Overview and Basics. <= >= == != & ^ | && ||
28Encapsulation benefits: Modularity: ? : = += -= *= /= %= &= ^= |=
The source code for an object can be <<= >>= >>>=. Java –
written and maintained independently of Overview and Basics.
the source code for other objects. Also, 58Statement type. Keyword. looping.
an object can be easily passed around in while, do-while , for. decision making.
the system. Information hiding: An object if-else, switch-case. exception handling.
has a public interface that other objects try-catch-finally, throw. branching.
can use to communicate with it. The object break, continue, label:, return. Control
can maintain private information and Flow Statements. Java – Overview and
methods that can be changed at any time Basics.
without affecting the other objects that 59while (expression) { statement(s) } do
depend on it. OOP concepts (2). Java – { statement(s) } while (expression); for
Overview and Basics. (initialization; termination; increment) {
29Message Software objects interact and statement } for ( ; ; ) { // infinite loop
communicate with each other by sending ... }. While, do-while and for. Java –
messages to each other. When object A Overview and Basics.
wants object B to perform one of B's 60if (expression) { statement(s) } if
methods, object A sends a message to (expression) { // code to perform true }
object B. OOP concepts (3). Java – else { // code to perform false }. switch
Overview and Basics. (intVariable) { case 1:
30The three components of a message: 1) System.out.println(„1"); break;
The object to which the message is default: System.out.println(„The number is
addressed (YourBicycle) 2) The name of the wrong !"); break; }. If, if-else and
method to perform (changeGears) 3) Any switch. Java – Overview and Basics.
parameters needed by the method 61try { statement(s) } catch
(lowerGear). OOP concepts (4). Java – (exceptiontype name) { statement(s) }
Overview and Basics. finally { statement(s) }. Try, catch and
31A class is a prototype that defines finally. Java – Overview and Basics.
the variables and the methods common to 62Break, continue and return. Break and
all objects of a certain kind. Visual continue: 1) break; || continue; 2) break
representation of class: Visual label; || continue label; Example (by
representation of bike class: OOP concepts analogy is continue): ... search: for ( ;
(5). Java – Overview and Basics. i < arrayOfInts.length; i++) { for (j =
32Inheritance Superclass Subclass. OOP 0; j < arrayOfInts[i].length; j++) { if
concepts (6). Java – Overview and Basics. (arrayOfInts[i][j] == searchfor) { foundIt
33Inheritance benefits: Subclasses = true; break search; } } }. Return: 1)
provide specialized behaviors from the return value; 2) return; Java – Overview
basis of common elements provided by the and Basics.
superclass. Through the use of 63Control Flow Statements(2). Question:
inheritance, programmers can reuse the What's wrong with the following code : if
code in the superclass many times. (i = 1) { /* do something */ }. Answer:
Programmers can implement superclasses Condition is ALWAYS true. Typical mistake
called abstract classes that define of programmers: = is an assignment == is a
"generic" behaviors. The comparison Ussually compiler warns about
abstract superclass defines and may it. Java – Overview and Basics.
partially implement the behavior, but much 64Control Flow Statements(3). Question:
of the class is undefined and What is an output if aNumber = 2? if
unimplemented. Other programmers fill in (aNumber >= 0) if (aNumber == 0)
the details with specialized subclasses. System.out.println("first
OOP concepts (7). Java – Overview and string"); else
Basics. System.out.println("second
34An interface is a device that string");
unrelated objects use to interact with System.out.println("third
each other. It is most analogous to a string"); Answer: second string third
protocol (an agreed on behavior). Example: string. Java – Overview and Basics.
„Java – overview and basics”.ppt
http://900igr.net/kartinka/informatika/java-overview-and-basics-164779.html
cсылка на страницу

„Java – overview and basics”

другие презентации на тему «„Java – overview and basics”»

«Языки програмирования» - Создание. Ассемблер. Языки программирования высокого уровня. Алгол. Ошибки. Настольные СУБД. Визуальные среды быстрого проектирования. XML. Си++. Расмус. Алгоритм и программа. Бейсик. Языки программирования баз данных. Искусственные языки. Компиляторы и интерпретаторы. Языки программирования. Кобол.

«Delphi» - Кнопка изменения знака числа. При нажатии на кнопку с цифрой 2 к тексту Edit-а прибавляется символ 2. Вычитание. Кнопка извлечения косинуса (думаю здесь все понятно). Переменной i присваиваем значение, введенное в Edit. Сохраняем все, компилируем и смотрим результат. Разместим на форме нужные нам компоненты:

«Библиотека шаблонов» - STL - алгоритмы представляют набор готовых функций. В STL существует понятие адаптированного функтора. Адаптеры. Составим программу, заменяющую в исходном массиве все единицы на нули. Основные виды алгоритмов. Однонаправленные итераторы (forward iterator). Пример использования итератора вывода. Итераторы ввода (input iterator).

«Грамматика языков» - При построении компиляторов такие грамматики не применяются. КС-грамматики широко используются при описании синтаксических конструкций языков программирования. Пример: грамматика целых десятичных чисел. Следовательно, можно говорить о полиномиальной сложности распознавателя для КС-языков. В компиляторах КЗ-языки не используются.

«Программы на Delphi» - С множественным выбором. Компонент Check Box. Делаем невидимыми Label – ы и Memo. Конечно, сначала нужно составить тест на бумаге. Аналогично оформляем место для 2 и 3 вопросов. Компоненты Radio Button и Check Box. Давайте посмотрим, как выводится в Memo результат теста. Использование Radio Group: Ставим кнопку для проверки выбранного ответа.

«Среда Delphi» - Разработка алгоритмов и сценария работы. Основные свойства компонента Edit: Text – содержит отображаемую строку данных. Запустить среду Delphi. В окне «Текстового редактора» отображаются и редактируются тексты программных модулей: Пример создания простейшего приложения. Width, Height – ширина, высота в пикселях.

Языки программирования

23 презентации о языках программирования
Урок

Информатика

130 тем
Картинки