20/05/2019
Object Oriented Programming (OOP)
Dr. Dr. Abraham Rodríguez Mota
[email protected] [email protected]
Java Standard Development Development Kit (SDK)
Contents
• • • • •
Where to get Java Standard Development Kit (JAVA SDK) Download and Installation Command line and Text Editor (Vi) IDEs Write, Compile and Execute a Java Program
1
20/05/2019
Java Standard Development Development Kit (SDK)
https://www.oracle.com/technetw https://www .oracle.com/technetwork/java/javase/down ork/java/javase/downloads/index.html loads/index.html
Java SDK
Java Standard Development Development Kit (SDK)
You must accept the License agreement
2
20/05/2019
Installation
Installation
3
20/05/2019
Installation
Installation
4
20/05/2019
Installation
Installation
5
20/05/2019
Installation
Command prompt
Installation
6
20/05/2019
Installation
Program Edition (Vi Editor)
• Vi is an one o f two powerhouse text editors in the Unix world, the other being EMACS. While obtuse, vi is extremely powerful and efficient. • There may be times when vi is the only text editor available, so it helps to at least know the basics.
• On Mac OS X (and Linux), vi is symlinked to vim (vi improved), a more modern free software version. Vim It is the default editor when changing a crontab. • Other options • pico • nano
7
20/05/2019
Program Edition (Vi Editor)
• Vi has two modes, command and insert (really, (really, three if you count replace mode). • Command mode is used to navigate, search, and issue other commands. • Insert mode is used to enter text. • Vi starts in command mode. mode.
Program Edition Edition (Vi Editor - Commands)
• While in command mode (case sensitive) move the cursor with arrow keys; if there aren't any arrow keys, use j,k,h,l • • • • • • • • • • • • • • • • • •
i - change change to insert mode mode (before (before cursor) cursor) a - change to insert mode (after cursor) A - change to insert mode (at end of line) r - replace replace one character character R - overwrite overwrite text text x - delete one one character character dd - delete delete one one line line yy - yank yank line (cop (copy) y) p - paste deleted or yanked text after cursor P - paste deleted or yanked text before cursor G - go to end of the the file 1G - go to top top of the file file J - merge next line with with this one / - search, follow / with text to find :wq - write write file file and quit quit :q! - quit without without saving saving %s/old/new/g - substitute; replace "old" "old" with "new" on all lines :g/pattern/d - delete all lines that match the pattern pattern
8
20/05/2019
Program Edition (Vi Editor)
•While in insert mode •ESC - change to command command mode •any text typed is entered at the cursor
Program Edition (Vi Editor)
Typical vi session
Linux users: a-linux-terminal-emulator-with-multipleterminals-in-one-window
1) Type "vi file.txt" at command prompt 2) Move cursor to where new text will be added 3) Type "i" to change to insert mode 4) Type new text 5) Type ESC to go back to command mode 6) Type ":wq" and ENTER to write the file and quit
9
20/05/2019
Program Edition (Vi Editor)
https://www.eclipse.org/
https://www.oracle.com/technetwork/ja https://www .oracle.com/technetwork/java/javase/down va/javase/downloads/index.html loads/index.html
https://www.bluej.org/ Terminator( Linux users): A Linux terminal terminal emulator emulator with multiple multiple terminals terminals in-one-window
https://www.jetbrains.com/company/brand/
First Java Program
1. 2. 3. 4. 5.
class Simple{ publ pu blic ic st stati atic c vo void id main(String args[]){ System.out.println("Hello Java"); Java"); } }
10
20/05/2019
First Java Program
• save save this this file file as Simp Simple. le.jav java a
To compile:
javac Simple.java Simple.j ava
To execute:
java Simple
First Java Program
To compile:
javac Simple.java
To execute:
java Simple
Did you find the mistakes in previous versions of this code?
When compilation goes without error there is not further messages Execution
11
20/05/2019
Program Edition (Vi Editor)
• Vi has two modes, command and insert (really, (really, three if you count replace mode). • Command mode is used to navigate, search, and issue other commands. Insert mode is used to enter text. • Vi starts in command mode.
12