CS240: Advanced Programming Concepts

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

COP 3530 JDK Environment Variables. COP 3530 JDK Environment Variables Environment Variables Environment variables are a set of dynamic values that can.
OO Programming in Java Objectives for today: Overriding the toString() method Polymorphism & Dynamic Binding Interfaces Packages and Class Path.
George Blank University Lecturer. CS 602 Java and the Web Object Oriented Software Development Using Java Chapter 4.
How to Create a Java program CS115 Fall George Koutsogiannakis.
Introduction to Java Programming
Java for High Performance Computing Jordi Garcia Almiñana 14 de Octubre de 1998 de la era post-internet.
CS-341 Dick Steflik Introduction. C++ General purpose programming language A superset of C (except for minor details) provides new flexible ways for defining.
CS-341 Dick Steflik Introduction. C++ General purpose programming language A superset of C (except for minor details) provides new flexible ways for defining.
Introduction to Java.
Session-02. Objective In this session you will learn : What is Class Loader ? What is Byte Code Verifier? JIT & JAVA API Features of Java Java Environment.
CS0007: Introduction to Computer Programming Setting Up Java.
CSE 1301 J Lecture 2 Intro to Java Programming Richard Gesick.
public static void main (String[] args)
Introduction to Java Programming with JBuilder 4
Computer Programming 12 Mr. Jean March 19 th, 2013.
Introduction to the Java Virtual Machine 井民全. JVM (Java Virtual Machine) the environment in which the java programs execute The specification define an.
Session One Introduction. Personal Introduction Role of programmers Robot Examination HUD & HID Uploading Code.
1 Module Objective & Outline Module Objective: After completing this Module, you will be able to, appreciate java as a programming language, write java.
Chapter 1: Introducing JAVA. 2 Introduction Why JAVA Applets and Server Side Programming Very rich GUI libraries Portability (machine independence) A.
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,
Java and C# [this is a bonus – it is not a required lesson] ACO101: Introduction to Computer Science.
Geoff Holmes and Bernhard Pfahringer COMP206-08S General Programming 2.
Introduction and Features of Java. What is java? Developed by Sun Microsystems (James Gosling) A general-purpose object-oriented language Based on C/C++
Lecture :2 1.  DEFENTION : Java is a programming language expressly designed for use in the distributed environment of the Internet. It was designed.
COP 3330 Notes 1/12. Today's topics Downloading Java and Eclipse Hello World Basic control structures Basic I/O Strings.
Netprog: Java Intro1 Crash Course in Java. Netprog: Java Intro2 Why Java? Network Programming in Java is very different than in C/C++ –much more language.
Univ. of TehranDistributed Operating Systems1 Advanced Operating Systems University of Tehran Dept. of EE and Computer Engineering By: Dr. Nasser Yazdani.
BEGINNING PROGRAMMING.  Literally – giving instructions to a computer so that it does what you want  Practically – using a programming language (such.
Chapter 1: Introducing JAVA. 2 Introduction Why JAVA Applets and web applications Very rich GUI libraries Portability (machine independence) A real Object.
22-July-2002cse142-13B-Development © 2002 University of Washington1 Development Tools CSE 142, Summer 2002 Computer Programming 1
Core Java Introduction Byju Veedu Ness Technologies httpdownload.oracle.com/javase/tutorial/getStarted/intro/definition.html.
1. An Introduction A Programming Language A Technology Java Development Kit Java API One Language: Three Editions Standard Edition Enterprise Edition.
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.
Slide Advanced Programming 2004, based on LY Stefanus's slides Native Methods.
introductory lecture on java programming
Software Development Introduction
3/5/2002e-business and Information Systems1 Java Java Java Virtual Machine (JVM) Java Application Program Interface (API) HW Kernel API Application Programs.
JAVA TRAINING IN NOIDA. JAVA Java is a general-purpose computer programming language that is concurrent, class-based, object-oriented and specifically.
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.
Learning Plan 6 Java Programming Intro to Object Oriented Programming.
CS 201 Lecture 1 (b) Using an IDE Tarik Booker CS 201: Introduction to Programming California State University, Los Angeles.
 It is a pure oops language and a high level language.  It was developed at sun microsystems by James Gosling.
Introduction to java (class and object). Programming languages: –Easier to understand than CPU instructions –Needs to be translated for the CPU to understand.
Sung-Dong Kim, Dept. of Computer Engineering, Hansung University Java - Introduction.
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.
2. Java language basics (1)
Sachin Malhotra Saurabh Choudhary
CS240: Advanced Programming Concepts
COMP 2100 From Python to Java
Intro to ETEC Java.
Before You Begin Nahla Abuel-ola /WIT.
Object-Oriented Programming Using Java
Programming Language Hierarchy, Phases of a Java Program
Key Ideas from day 1 slides
Text by: Lambert and Osborne
Lecture 1 Runtime environments.
Generics, Lambdas, Reflections
Java Review: Reference Types
Java Intro III.1 (Fr Feb 23).
File Organization.
From C++ to Java Java history: Oak, toaster-ovens, internet language, panacea What it is O-O language, not a hybrid (cf. C++) compiled to byte-code, executed.
Java for IOI.
(Computer fundamental Lab)
CSC 253 Lecture 2.
Lecture 1 Runtime environments.
SPL – PS1 Introduction to C++.
CS 240: Advanced Programming Concepts
Presentation transcript:

CS240: Advanced Programming Concepts Review Java Language Basics

Yet Another Java Resource… http://docs.oracle.com/javase/tutorial/java/TOC.html

Review

C++ (Compiled Language) Model

Interpreted Language Model What does this mean for performance?....

Bring on the JIT (Just In Time) Compiler (Note: This example is based on Oracle’s Jrockit JVM) http://docs.oracle.com/cd/E13150_01/jrockit_jvm/jrockit/geninfo/diagnos/underst_jit.html

But Wait, There’s More… Runtime Optimization Function Inlining Selective Compilation Data Optimizations Etc… http://docs.oracle.com/cd/E13150_01/jrockit_jvm/jrockit/geninfo/diagnos/underst_jit.html

Results…

Result 2 (a bit easier)…

Take Away: Java programs are not necessarily “slower” than precompiled programs JIT compilation Potential for dynamic runtime optimization Interpreted / JIT’d languages offer certain advantages during development and maintenance such as reduced/eliminated compilation times for testing etc. Interpreted languages are highly portable Use of an interpreter/JIT compiler like the JVM means additional resource requirements at runtime vs a precompiled model

Java Basics Continued The main method(s) Command line arguments Arrays as objects Primitive types !!References!! Garbage collection Classes and objects, classes as objects Variables Methods Packages, import vs. #include

C++ File Organization g++ linker X.h Y.h Z.h Exactly one main function X.cpp Y.cpp Z.cpp linker X.o Y.o Z.o EXE

Java File Organization javac At least one main method X.java Y.java Z.java bin X.class Y.class Z.class java –cp bin/ X arg1 arg2 … “java” = the Java virtual machine (runs your program) “cp” = class path (directory containing the .class files) “X” = name of the class with main method “argN” = command line arguments passed to main method

Tips and Tricks Use the provided BufferReader, don’t use a stream… You might consider looking up/using the “split” method… (String class) Don’t use String concatenation… use a StringBuilder object… (better performance) Your ppm string needs to be terminated with a newline… (or it won’t work)