Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
School of Computer Science & Information Technology Programming Languages G6DICP - Lecture 2 The Java Programming Language Formal languages in which computer programs are written All languages consist of syntax and semantics Low level languages - close to machine code High level languages - further removed from machine code 2 Language Generations Computer Programs First: Raw machine code Second: Assembly language (NB processor dependent) Third: High level languages (eg Java, C, Fortran, Cobol etc) Fourth: Application languages (eg SQL, Postcript Fifth: AI languages (expert systems, fuzzy logic, neural networks etc) 3 Computers are "stupid" Mathematical and logical instructions are executed very quickly and accurately. They obediently but stupidly do what you tell them to - not necessarily what you want them to! Tiny errors in a program can cause major problems when it is executed. Always remember syntax as well as semantics! Careful planning is essential Flow charts are a useful tool to represent program flow visually. 4 Components of Tea Making Program Kettle-Boiling Program Is Kettle full? No Fill Kettle Fill Kettle Yes Boil Kettle Place kettle under tap Place Kettle on hob Open tap Turn on heat Wait Make Tea 5 Wait No Boil Kettle 6 Is kettle full? Is kettle boiling? Yes Close tap Turn off heat Yes Kettle-Boiling Program What is Java? Fill Kettle Place k ettle u n d er tap Is Kettle full? No O p en tap Java is a programming language Wait No Created by Sun Microsystems Is k ettle fu ll? Yes Y es Clo se tap B oil Kettle Java is not only for web programming Place Kettle on hob Turn on heat Wait Is kettle boiling? Often used for web programming Initially marketed as a web development system General purpose programming language Yes Turn off heat Very similar to C++ - simplified! Make Tea 7 8 Java Model Features of Java Byte Code Originally developed for hardware devices. Platform Independent Binaries 9 Virtual Machine Most operating systems Also hardware devices Robust and easy to use Object Oriented and highly modular Internationalisation Networking and Security features Operating System Hardware 10 Java VM Platforms Sun supported platforms Solaris Win32 (Windows 95/98 & NT) Linux “Hardware” Applications Other Unix Mac OS Palm OS Symbian and many others Delivered over the Internet Require a Java capable WWW browser Servlets 12 Standalone programs Require a VM Applets Third party platforms (freely licensed) 11 Types of Java Programs Require a Java capable WWW server Java Application Java Applet Storage Source Code Web Server Byte Code HTML Byte Code CPU/memory Compiler Web Browser Web Browser Program Execution (embedded in web page) Program Execution Interpreter (VM) Program Execution 13 14 Flavours of Java Development Software Java Developers Kit (JDK) 15 Freely available from Sun for most platforms “no frills” development JavaScript Compiler - javac Interpreter - java Applet viewer - appletviewer Utilities (auto-documentation, debugging, optimisation etc) This is not Java! Java Versions Very obsolete JDK 1.0 Java Runtime Environment (JRE) Obsolete Integrated Development Environments / RAD Systems Java 2 Third party VM’s 16 JDK 1.1 JDK 1.2, 1.3 & 1.4