Java.  Java is an object-oriented programming language.  Java is important to us because Android programming uses Java.  However, Java is much more.

Slides:



Advertisements
Similar presentations
What is a Computer Program? For a computer to be able to do anything (multiply, play a song, run a word processor), it must be given the instructions.
Advertisements

In Review JAVA C++ GUIs - Windows Webopedia.com.
CS0007: Introduction to Computer Programming Console Output, Variables, Literals, and Introduction to Type.
Introduction To Java Objectives For Today â Introduction To Java â The Java Platform & The (JVM) Java Virtual Machine â Core Java (API) Application Programming.
Lab Information Security Using Java (Review) Lab#0 Omaima Al-Matrafi.
Creating a Program In today’s lesson we will look at: what programming is different types of programs how we create a program installing an IDE to get.
Lab#1 (14/3/1431h) Introduction To java programming cs425
What is a Programming Language? The computer operates using binary numbers. The computer only knows about 1’s and 0’s. Humans can also use 1’s and 0’s,
Programming Creating programs that run on your PC
Lecture 2: Do you speak Java?. From Problem to Program Last Lecture we looked at modeling with objects! Steps to solving a business problem –Investigate.
Lecture 2: Do you speak Java?. From Problem to Program Last Lecture we looked at modeling with objects! Steps to solving a business problem –Investigate.
SM3121 Software Technology Mark Green School of Creative Media.
Asst.Prof.Dr.Ahmet Ünveren SPRING Computer Engineering Department Asst.Prof.Dr.Ahmet Ünveren SPRING Computer Engineering Department.
3-1 3 Compilers and interpreters  Compilers and other translators  Interpreters  Tombstone diagrams  Real vs virtual machines  Interpretive compilers.
Course: Introduction to Computers
01 Introduction to Java Technology. 2 Contents History of Java What is Java? Java Platforms Java Virtual Machine (JVM) Java Development Kit (JDK) Benefits.
Source Code Basics. Code For a computer to execute instructions, it needs to be in binary Each instruction is given a number Known as “operation code”
Lesson 4 Computer Software
Computer Programming 12 Mr. Jean March 3 rd, 2014.
CSC 142 A 1 CSC 142 Introduction to Java [Reading: chapter 0]
Introduction to Java CSIS 3701: Advanced Object Oriented Programming.
Parts of a Computer Why Use Binary Numbers? Source Code - Assembly - Machine Code.
Introduction to Computer Programming itc-314
Android 2: Introduction to the Technology Kirk Scott 1.
CS 355 – Programming Languages
High thoughts must have high language. Aristophanes
Unit 1: Java Introduction and Eclipse Kirk Scott.
Liang, Introduction to Java Programming, Sixth Edition, (c) 2007 Pearson Education, Inc. All rights reserved Programming Languages Machine.
Java Introduction Lecture 1. Java Powerful, object-oriented language Free SDK and many resources at
Computer Programming 12 Mr. Jean March 19 th, 2013.
Sadegh Aliakbary Sharif University of Technology Fall 2012.
INTRODUCTION TO JAVA AND ANDROID. Slide 2 Our Ecosystem Java Eclipse Android SDK.
© 2012 Pearson Education, Inc. All rights reserved. 1-1 Why Java? Needed program portability – Program written in a language that would run on various.
Chapter 1: Introduction to Programs, and Java 1. Objectives To review programs (§ ). To understand the relationship between Java and the World Wide.
1 2. Program Construction in Java Programming Fundamentals.
Copyright © 2007 Addison-Wesley. All rights reserved.1-1 Reasons for Studying Concepts of Programming Languages Increased ability to express ideas Improved.
Introduction to Programming Lecture No. 1. Books  Deitel & Deitel :– C++ How to Program  Kernighan and Ritchie:- The C Programming Language.
Robert Crawford, MBA West Middle School.  Explain how the binary system is used by computers.  Describe how software is written and translated  Summarize.
CE Operating Systems Lecture 3 Overview of OS functions and structure.
Module 4 Part 2 Introduction To Software Development : Programming & Languages Introduction To Software Development : Programming & Languages.
Computer Programming 2 Why do we study Java….. Java is Simple It has none of the following: operator overloading, header files, pre- processor, pointer.
Programming Fundamentals Lecture No. 2. Course Objectives Objectives of this course are three fold 1. To appreciate the need for a programming language.
 Programming - the process of creating computer programs.
© 2012 Pearson Education, Inc. All rights reserved types of Java programs Application – Stand-alone program (run without a web browser) – Relaxed.
Today… “Hello World” ritual. Brief History of Java & How Java Works. Introduction to Java class structure. But first, next slide shows Java is No. 1 programming.
Lesson 1 1 LESSON 1 l Background information l Introduction to Java Introduction and a Taste of Java.
Introduction to Computer Programming itc-314 Lecture 04.
Compilers and Interpreters
Programming Languages Concepts Chapter 1: Programming Languages Concepts Lecture # 4.
Programming 2 Intro to Java Machine code Assembly languages Fortran Basic Pascal Scheme CC++ Java LISP Smalltalk Smalltalk-80.
OPERATING SYSTEMS DO YOU REQUIRE AN OPERATING SYSTEM IN YOUR SYSTEM?
1 Sections Java Virtual Machine and Byte Code Fundamentals of Java: AP Computer Science Essentials, 4th Edition Lambert / Osborne.
Lesson 2: First Java Programs. 2.1 Why Java? Java is one of the most popular programming languages in the world. Java is a modern object-oriented programming.
Fundamental of Java Programming (630002) Unit – 1 Introduction to Java.
Introduction to Programming and App Inventor. Introduction What is a computer program? Introducing App Inventor Getting hands on with App Inventor.
Object Oriented Programming in
Introduction to programming
Chapter 1 Introduction to Computers, Programs, and Java
A451 Theory – 7 Programming 7A, B - Algorithms.
Introduction Enosis Learning.
CMPE419 Mobile Application Development
Introduction Enosis Learning.
Programming Languages
Outline Chapter 2 (cont) OS Design OS structure
(Computer fundamental Lab)
Java Programming Introduction
Tonga Institute of Higher Education IT 141: Information Systems
Tonga Institute of Higher Education IT 141: Information Systems
CMPE419 Mobile Application Development
Outcome of the Lecture Upon completion of this lecture you will be able to understand Fundamentals and Characteristics of Java Language Basic Terminology.
Presentation transcript:

Java

 Java is an object-oriented programming language.  Java is important to us because Android programming uses Java.  However, Java is much more than just the language for Android.

 What are some of Java’s characteristics that distinguish it from other programming languages?  What features does it have that might make it useful in situations where other languages would not be as suitable?

 Before we look at Java, we should understand how programs are run on machines.  When program code is written, it doesn’t run it as the code you write it in. Instead, it has to be ‘compiled’ into a language that the machine itself can understand.  When you run the program after compilation, it’s running a set of instructions built specifically for its system.  However, different system architectures have different ways of reading that code, so the compiled machine code will only run on that specific architecture.

 From a technical point of view, Java has one fundamental characteristic which all other important characteristics stem from.  Java is a language which is interpreted on a simulated hardware architecture.  Most languages aren’t directly understood by a machine. They have to be converted (compiled) into proper machine code first. But, Java finds a half-way point to full machine code, by ‘simulating’ the language.  It is possible to design hardware that runs Java code directly, but in common computing environments like Windows and Unix, installation of Java means that a simulation has been installed.

 For most languages like C or C++, compilation of a program results in an executable target file (*.exe) which consists of machine code for the architecture which it was designed.  This presents a portability problem, as the compiled program would only work on that specific architecture.  For Java, the process is still referred to as compilation, but it is not literal compilation. When Java source code is compiled, the result is “byte code”, which is code which runs on the simulated Java machine.

 In such a design, the programming language is merely a layer in a system’s software architecture and it is not dependent on the underlying hardware architecture of the machine.  As a result, Java is (in theory) a “universal” programming language.  Versions of Java exist for various hardware architectures. These implementations differ internally.

 The intent of this is for the Java code generated for the different environments to be exactly the same.  Thus, Java programs should be freely portable between them.  So if a program is written in one environment, no changes to the source code should be necessary in order for its byte code to be directly run in a different environment.

 “Write once, run everywhere”  This applies to desktop computers.  Even in this case, the reality is that subtle differences in implementations of the Java machine lead to problems.  “Write once, debug everywhere.”

 For us, it’s important to realize that Java as used in Android does differ from Android as used in other environments.  The basic syntax is the same, but the overall structure of the Android apps is different from the structure of apps in a desktop environment.  An Android app will only run on an Android device. It will not run anywhere else.

 As with all system and software design decisions, the nature of Java involves trade-offs.  One of the driving forces behind Java was the World Wide Web.  Java “applets”, which will be covered later.  If a “universal” programming language exists, then programs can be downloaded and run on users’ machines regardless of the hardware involved.  Now Java has been adapted to accomplish something similar in the cell phone environment.

 There is a big trade-off in using Java.  Since a simulated machine interprets Java’s “half- way code”, it makes it slower than running fully- compiled code. It could be up to 10 times slower.  But, since hardware nowadays have become much faster, and because the Web and cell phones are a preferred means of distributing programs, the trade-off of speed for portability has been well worth it.

 Some languages, such as C and C++, allow the programmer to directly access memory addresses in a machine’s hardware, through the use of pointers.  Java cannot do this.  However, direct access to memory can be harmful to a system, intentionally or not.  Since Java can’t do this, users can be assured that Java programs won’t do anything. destructive as a result of direct memory access.  Thus, Java supports both portability and safety of programs.

 Java is object-oriented, and is designed to support event-driven programming.  With this in mind, we can create programs with graphical user interfaces which support point-and-click actions.  In addition to many advanced features within the language itself, it comes with libraries of complete code components which an experienced programmer can use instead of writing components from scratch.

 Java also has basic syntactic features found in structured programming languages, namely sequential execution of blocks of code, conditional execution (if statements), and iterative execution (loops).  All of this, along with object-oriented concepts, will be covered later on.

 Java was not designed for teaching or learning purposes.  It was designed for building complex applications.  It won’t be possible to learn all of Java within a single course. There is simply too much.  But, after being introduced to the basics of Java and Android development, it should be simple to do your own research to solidify your understanding.

 The Java language is interpreted on a simulated machine architecture.  This makes Java source and target code highly portable.  This also makes it possible to download Java code from the World Wide Web.  The interpretation of Java code makes running it slower.  Java programs do not support direct memory access, which makes downloaded programs safer.

 Java is an object-oriented language containing the features needed in order to write graphical applications with point-and- click interfaces.  Java was designed as a production language, not a teaching language. It contains many features and comes with many libraries.  It is possible to do things in Java that cannot be done in other languages.