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.

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.
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.
Lab#1 (14/3/1431h) Introduction To java programming cs425
Java.  Java is an object-oriented programming language.  Java is important to us because Android programming uses Java.  However, Java is much more.
1 Chapter 3 Programs and Packages. 2 Java Virtual Machine (JVM) Java programs execute on the JVM. The JVM is a virtual rather than a physical machine,
1 Programming Languages Translation  Lecture Objectives:  Be able to list and explain five features of the Java programming language.  Be able to explain.
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.
Introduction to Java.
3-1 3 Compilers and interpreters  Compilers and other translators  Interpreters  Tombstone diagrams  Real vs virtual machines  Interpretive compilers.
Using the Java programming language compiler. Review of relevant material from previous lectures From previous lectures: A computer can only execute machine.
CSE 1301 J Lecture 2 Intro to Java Programming Richard Gesick.
Marlene Galea.  The JDK (Java Development Kit)  An IDE (Integrated Development Environment) ◦ Different IDEs include:  JCreator  NetBeans  BlueJ.
Java PAL.  Contains the development kit and the runtime environment ( aka the Java Virtual Machine )  Download Link:
Advanced OOP MCS-3 OOP BSCS-3 Lecture # 1
Introduction to Java Tonga Institute of Higher Education.
Introducing Java.
Chapter 1 Coding Introduction.
Introduction to Java CSIS 3701: Advanced Object Oriented Programming.
Parts of a Computer Why Use Binary Numbers? Source Code - Assembly - Machine Code.
M. Taimoor Khan * Java Server Pages (JSP) is a server-side programming technology that enables the creation of dynamic,
CS413: Java Programming language Applications Applets
CMSC 202 Computer Science II for Majors Object-Oriented Programming.
Java Introduction Lecture 1. Java Powerful, object-oriented language Free SDK and many resources at
Chapter 1 What is Programming? Lecture Slides to Accompany An Introduction to Computer Science Using Java (2nd Edition) by S.N. Kamin, D. Mickunas, E.
UCSC All rights reserved. No part of this material may be reproduced and sold. 1 IT1202-Fundamentals Of Programming (Using JAVA) Interacting with.
Computer Programming A program is a set of instructions a computer follows in order to perform a task. solve a problem Collectively, these instructions.
Chapter 34 Java Technology for Active Web Documents methods used to provide continuous Web updates to browser – Server push – Active documents.
JAVA Java is a programming language and computing platform first released by Sun Microsystems in It was first developed by James Gosling at Sun Microsystems,
Introduction to Computer Systems and the Java Programming Language.
1 CSC204 – Programming I Lecture 2 Intro to OOP with Java.
© 2012 Pearson Education, Inc. All rights reserved. 1-1 Why Java? Needed program portability – Program written in a language that would run on various.
Session 1 Introduction to Java. Objectives Java Simplified / Session 1 / 2 of 32 Explain the history of Java Explain Java in brief List the types of Java.
1 MSCS 237 Overview of web technologies (A specific type of distributed systems)
Getting started with Programming using IDE. JAVA JAVA IS A PROGRAMMING LANGUAGE AND A PLATFORM. IT CAN BE USED TO DELIVER AND RUN HIGHLY INTERACTIVE DYNAMIC.
Object Oriented Programming Examples: C++, Java Advantages: 1. reusibility of code 2. ability to adapt (extend) previously written code.
Lecture 1. Introduction to Programming and Java MIT- AITI 2003.
A compiler is a computer program that translate written code (source code) into another computer language Associated with high level languages A well.
Chapter 4 Software. Chapter 4: Software Generations of Languages Each computer is wired to perform certain operations in response to an instruction. An.
By: Cheryl Mok & Sarah Tan. Java is partially interpreted. 1. Programmer writes a program in textual form 2. Runs the compiler, which converts the textual.
© 2012 Pearson Education, Inc. All rights reserved types of Java programs Application – Stand-alone program (run without a web browser) – Relaxed.
©2016 Pearson Education, Inc. Upper Saddle River, NJ. All Rights Reserved. CSC 110 – INTRO TO COMPUTING - PROGRAMMING Overview of Programming.
Getting Started With Java September 22, Java Bytecode  Bytecode : is a highly optimized set of instructions designed to be executed by the Java.
Lesson 1 1 LESSON 1 l Background information l Introduction to Java Introduction and a Taste of Java.
1 Introduction Read D&D Sec 1.8; Sec 1.13 THE Java tutorial -
Representation of Data - Instructions Start of the lesson: Open this PowerPoint from the A451 page – Representation of Data/ Instructions How confident.
20-753: Fundamentals of Web Programming Copyright © 1999, Carnegie Mellon. All Rights Reserved. 1 Lecture 15: Java Basics Fundamentals of Web Programming.
Programming 2 Intro to Java Machine code Assembly languages Fortran Basic Pascal Scheme CC++ Java LISP Smalltalk Smalltalk-80.
Fundamental of Java Programming (630002) Unit – 1 Introduction to Java.
Introduction to Algorithm. What is Algorithm? an algorithm is any well-defined computational procedure that takes some value, or set of values, as input.
Chapter 1 Coding Introduction.
Applications Active Web Documents Active Web Documents.
Topic 2: Hardware and Software
Installing Java on a Home machine
Why don’t programmers have to program in machine code?
Lecture 1b- Introduction
Writing, Compiling and Running a C program
Programming languages
Programming Language Hierarchy, Phases of a Java Program
Topic: Difference b/w JDK, JRE, JIT, JVM
Introduction to Java Dept. Business Computing University of Winnipeg
Assembler, Compiler, Interpreter
Installing Java on a Home machine
Chapter 1 Coding Introduction.
Introduction CSC 111.
Assembler, Compiler, Interpreter
(Computer fundamental Lab)
Review of Previous Lesson
Presentation transcript:

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 current problem (Analysis) –Transform this model to logical models (Design) –Transform this model to software (implementation) Need to translate model to something computers can understand (mathematical equations)

Parlez Vous Binary? How do we translate our business problem into machine code? Initially, a programmer writes a program in a particular programming language. This is called source code!!!!! To execute the program however, the programmer must translate it into machine language……the language that the computer understands. How do we do this? –A COMPILER does this!!!!!

Compiler A compiler converts source code into machine level instructions Almost every programming language comes with a compiler In effect, the compiler is the language because it defines which instructions are acceptable

Javac The Java compiler (javac) is the component of the Java Developers kit (JDK) USED TO TRANSFORM Java source code files into bytecode (not machine code) –Javac phil.java Bytecode is the compiled format for Java programs. Once a Java program has been converted to bytecode, it can be transferred across a network and executed by Java Virtual Machine

Java Virtual Machine Bytecode is not really machine code and cannot be used by a computer – it must be interpreted The Java Virtual Machine (JVM) is an interpreter, it interprets byte code and can thus execute quickly The Java interpreter is built into Java compatible web browsers such as Netscape navigator which enables applets to run

Why Compile and Interpret? Because byte code is used instead of machine code, a java program can be executed on any machine that has a Java interpreter This makes java extremely portable……a program can be compiled on one machine and executed on any Java used extensively on web sites Java not only offers portability but identical behaviour on different systems “WRITE ONCE, RUN EVERYWHERE”

Compiling and interpreting Java source code is written with a text editor and saved in plain ASCII text with file extension.java These files are compiled using the javac compiler –E.g. javac Examplehelloworld.java Executable bytecode class files have the extension.class and they represent a Java class in its usable form The Java compiler generates exactly one.class file for each class you create. It is possible to define more than one class in a single source file, it is therefore possible for the compiler to generate multiple class files from a single source file.

Java and the Web Applet written and compiled in exact same way as Java application Applets downloaded when user navigates to page Browsers contain Java virtual machine and applet is executed on client machine

Java Applets Applets were originally small applications but there is no size restriction on Applets As applets are downloaded, there is a risk that they may –Contain Bugs –Be written maliously However, browsers are usually configured to prevent applets from accessing files on the machine on which they execute Applets can access files on the server from which they were downloaded Java applications will be covered in this course but applets will be revisited