Lecture 3: Scaffolding and Output Announcements & Review Announcements Discussion Sections: PAI 5.70 until further notice Pair in same discussion

Slides:



Advertisements
Similar presentations
Introduction to programming in java. Input and output to screen with Java program Structure of Java programs Statements Conditional statements.
Advertisements

IT253: Computer Organization Lecture 6: Assembly Language and MIPS: Programming Tonga Institute of Higher Education.
Object Oriented Programming in Java George Mason University Fall 2011
Begin Java Pepper. Objectives What is a program? Learn the basics of your programming tool: BlueJ Write a first Java program and see it run Make some.
Chapter 2: Your First Program! Hello World: Let’s Program  All programs must have the extension.java  Our first program will be named: HelloWorld.java.
Slides prepared by Rose Williams, Binghamton University Chapter 1 Getting Started 1.1 Introduction to Java.
How to Create a Java program CS115 Fall George Koutsogiannakis.
1 Programming Languages b Each type of CPU has its own specific machine language b But, writing programs in machine languages is cumbersome (too detailed)
Java Intro. A First Java Program //The Hello, World! program in Java public class Hello { public static void main(String[] args) { System.out.println("Hello,
1 Programming & Programming Languages Overview l Machine operations and machine language. l Example of machine language. l Different types of processor.
Slide 1 of 40. Lecture A The Java Programming Language Invented 1995 by James Gosling at Sun Microsystems. Based on previous languages: C, C++, Objective-C,
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.
Chapter 2: Java Fundamentals Java Program Structure.
CS107 Introduction to Computer Science Java Basics.
Introduction to Java.
1. 2 Chapter 1 Introduction to Computers, Programs, and Java.
Programming a computer. What does programming a computer mean ? Programming a computer: Since a computer can only execute machine instructions (encoded.
IB Computer Science II Paul Bui
“Introduction to Programming With Java”
(C) 2010 Pearson Education, Inc. All rights reserved.  Java programs normally go through five phases  edit  compile  load  verify  execute.
Basics Programming Concepts. Basics A computer program is a set of instructions to tell a computer what to do Machine language = circuit level language.
CS 106 Introduction to Computer Science I 01 / 25 / 2010 Instructor: Michael Eckmann.
Welcome to the Lecture Series on “Introduction to Programming With Java”
Session One Introduction. Personal Introduction Role of programmers Robot Examination HUD & HID Uploading Code.
FRST JAVA PROGRAM. Getting Started with Java Programming A Simple Java Application Compiling Programs Executing Applications.
Introduction to C++ Programming Language
Java Programming, Second Edition Chapter One Creating Your First Java Program.
Board Activity Find your seat on the seating chart Login – Remember your login is your first initial your last name and the last three numbers of your.
Week 1 - Friday.  What did we talk about last time?  Our first Java program.
Java means Coffee Java Coffee Beans The name “JAVA” was taken from a cup of coffee.
2-1 Hardware CPU Memory - 2 kinds Network Graphics Input and Output Devices.
CHAPTER 3 GC Java Fundamentals. 2 BASICS OF JAVA ENVIRONMENT  The environment  The language  Java applications programming Interface API  Various.
 JAVA Compilation and Interpretation  JAVA Platform Independence  Building First JAVA Program  Escapes Sequences  Display text with printf  Data.
A First Simple Program /* This is a simple Java program. Call this file "Example.java".*/ class Example { // Your program begins with a call to main().
J ava P rogramming: From Problem Analysis to Program Design, From Problem Analysis to Program Design, Second Edition Second Edition D.S. Malik D.S. Malik.
Chapter 1: Introducing JAVA. 2 Introduction Why JAVA Applets and web applications Very rich GUI libraries Portability (machine independence) A real Object.
A compiler is a computer program that translate written code (source code) into another computer language Associated with high level languages A well.
Overview of Java CSCI 392 Day One. Running C code vs Java code C Source Code C Compiler Object File (machine code) Library Files Linker Executable File.
CSI 3125, Preliminaries, page 1 Compiling the Program.
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.
CSc 201 Introduction to Java George Wells Room 007, Hamilton Building
By Mr. Muhammad Pervez Akhtar
CS 106 Introduction to Computer Science I 01 / 22 / 2007 Instructor: Michael Eckmann.
Java FilesOops - Mistake Java lingoSyntax
Getting Started With Java September 22, Java Bytecode  Bytecode : is a highly optimized set of instructions designed to be executed by the Java.
CS 106 Introduction to Computer Science I 01 / 22 / 2008 Instructor: Michael Eckmann.
Lecture 4: For Loops Announcements & Review Announcements Examples posted after lecture on schedule Discussion Section exercises on line before 9am Tuesdays.
Execution ways of program References: www. en.wikipedia.org/wiki/Integrated_development_environment  You can execute or run a simple java program with.
Programming 2 Intro to Java Machine code Assembly languages Fortran Basic Pascal Scheme CC++ Java LISP Smalltalk Smalltalk-80.
Introduction to 1. What is Java ? Sun Microsystems Java is a programming language and computing platform first released by Sun Microsystems in The.
Introduction to Algorithm. What is Algorithm? an algorithm is any well-defined computational procedure that takes some value, or set of values, as input.
Introduction CMSC 202 Fall Instructors Mr. Ryan Bergeron – Lecture Section 01 Tues/Thu 1:00 – 2:15 am, Sondheim 111 – Lecture Section 04 Tues/Thu.
CS-140 Dick Steflik Lecture 3. Java C++ Interpreted optimized for the internet Runs on virtual ized machine Derived from C++ Good object model Widely.
Introduction to programming in java
Dept of Computer Science University of Maryland College Park
Object-Oriented Programming Using Java
GC101 Introduction to computer and program
Programming Language Hierarchy, Phases of a Java Program
Chapter 3 GC 101 Java Fundamentals.
Introduction to.
Assembler, Compiler, Interpreter
Hands-on Introduction to JAVA
Java Intro.
Assembler, Compiler, Interpreter
IB Computer Science II Paul Bui
Chapter 2: Java Fundamentals
Programming language translators
Presentation transcript:

Lecture 3: Scaffolding and Output Announcements & Review Announcements Discussion Sections: PAI 5.70 until further notice Pair in same discussion 305j in subject Last Time Acquiring & creating language Noam Chomsky Catherine Snow

Lecture 3: Scaffolding and Output Today Compilation and Execution –What’s “javac” do? –What happens next? Basics –Scaffolding - what every program needs –Making the computer talk to you!

Lecture 3: Scaffolding and Output Static Compilation & Execution Easier case: The C programming language “static” ahead-of-time compilation model: Tool: “cc” the C compiler Your file: Circle.c “cc Circle.c” -> (Circle.a) -> a.out Executable: a.out “a.out ”

Lecture 3: Scaffolding and Output Dynamic Compilation & Execution Java “dynamic” compilation model: 2 Tools “javac” the Java bytecode compiler “java” the Java virtual machine Your file: Circle.java What do you do in Bluej? “javac Circle.java” -> Circle.class Executing Bytecode: low-level virtual machine form machine independent, portable What do you do in Bluej? “java Circle.class ”

Lecture 3: Scaffolding and Output Java Dynamic Compilation Executing Bytecode: “java Circle.class ” What happens? Interpretation vs Dynamic Compilation

Lecture 3: Scaffolding and Output Dynamic Compilation & Execution Java “dynamic” compilation model: Executing Bytecode: “java Circle.class ” - What happens? Interpreting 1.map each bytecode to a machine code sequence, 2.for each bytecode, execute the sequence Translation to machine code 1.map all the bytecodes to machine code (or a higher level intermediate representation), 2.massage them (e.g., get rid of redundancies between instructions), 3.execute the machine code

Lecture 3: Scaffolding and Output Dynamic Compilation & Execution “Hotspot” compilation, a hybrid 1.Initially interpret 2.Find the “hot” (frequently executed code) methods, and translate only these hot methods to machine code

Lecture 3: Scaffolding and Output Basics What you write –Scaffolding - what every program needs –Making the computer talk to you! Comments - tell the compiler to ignore text // the compiler ignores this text on the same line /* For multi-line comments, you can use * this form and it will ignore all this text * too until it sees */

Lecture 3: Scaffolding and Output Scaffolding: Magic or Logical? /* Kathryn S McKinley * January 10, 2005 * file: Song.java * My program does nothing right now! */ public class Song { // code can go here public static void main (String [] args) { // code here too }

Lecture 3: Scaffolding and Output Printing System.out.print(“I love CS305j.”); System.out.println(“I love CS305j.”); [More examples in Bluej…]

Lecture 3: Scaffolding and Output Questions?