Session 1 CS-240 Data Structures Binghamton University Dick Steflik.

Slides:



Advertisements
Similar presentations
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 12 Introduction to ASP.NET.
Advertisements

1.00 Lecture 37 A Brief Look at C++: A Guide to Reading C++ Programs.
A C++ Crash Course Part II UW Association for Computing Machinery Questions & Feedback.
STRING AN EXAMPLE OF REFERENCE DATA TYPE. 2 Primitive Data Types  The eight Java primitive data types are:  byte  short  int  long  float  double.
MPI and C-Language Seminars Seminar Plan (1/3)  Aim: Introduce the ‘C’ Programming Language.  Plan to cover: Basic C, and programming techniques.
Date: Subject:Distributed Data Processing Name:Maria Br ü ckner.
CERTIFICATION OBJECTIVES Use Class Members Develop Wrapper Code & Autoboxing Code Determine the Effects of Passing Variables into Methods Recognize when.
Memory allocation CSE 2451 Matt Boggus. sizeof The sizeof unary operator will return the number of bytes reserved for a variable or data type. Determine:
C++ & Java Dick Steflik CS-248. Similarities Syntax - almost identical Object Model - very similar Stream based I/O.
6/10/2015C++ for Java Programmers1 Pointers and References Timothy Budd.
C For Java Programmers Tom Roeder CS sp. Why C? The language of low-level systems programming  Commonly used (legacy code)  Trades off safety.
Nyhoff, ADTs, Data Structures and Problem Solving with C++, Second Edition, © 2005 Pearson Education, Inc. All rights reserved Introduction.
Introduction and a Review of Basic Concepts
Nyhoff, ADTs, Data Structures and Problem Solving with C++, Second Edition, © 2005 Pearson Education, Inc. All rights reserved Introduction.
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.
C++ vs. Java: Similiarities & Differences Dr. Jeyakesavan Veerasamy Director of CS UTDesign program & CS Teaching Faculty University.
A function (procedure) code to perform a task (carry out an algorithm) Return_type Func(parameters) ---- Func (arguments) --- Return value.
CMSC 341 Introduction to Java Based on tutorial by Rebecca Hasti at
Java Security Updated May Topics Intro to the Java Sandbox Language Level Security Run Time Security Evolution of Security Sandbox Models The Security.
OOP Languages: Java vs C++
C++ / G4MICE Course Session 3 Introduction to Classes Pointers and References Makefiles Standard Template Library.
Java Security. Topics Intro to the Java Sandbox Language Level Security Run Time Security Evolution of Security Sandbox Models The Security Manager.
1 CISC181 Introduction to Computer Science Dr. McCoy Lecture 19 Clicker Questions November 3, 2009.
Java and C++, The Difference An introduction Unit - 00.
University of Calgary – CPSC 441. C PROGRAM  Collection of functions  One function “main()” is called by the operating system as the starting function.
1 The Java Virtual Machine Yearly Programming Project.
By Noorez Kassam Welcome to JNI. Why use JNI ? 1. You already have significantly large and tricky code written in another language and you would rather.
Algorithm Programming Bar-Ilan University תשס"ח by Moshe Fresko.
Introduction to Java University of Sunderland CSE301 Harry R. Erwin, PhD.
Geoff Holmes and Bernhard Pfahringer COMP206-08S General Programming 2.
Java Programming Presented by Daniel Rosenthal Friday, November 30 th, 2007.
2: Everything is an Object You Manipulate Objects Using References Primitives Arrays in Java Scoping You Never Destroy Objects Creating New Data Types:
Introduction to java Prepared By:-Pragnesh Patel Lect. In Computer Dept. NSIT,Jetalpur 1.
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.
Lec 6 Data types. Variable: Its data object that is defined and named by the programmer explicitly in a program. Data Types: It’s a class of Dos together.
Computer Science and Software Engineering University of Wisconsin - Platteville 2. Pointer Yan Shi CS/SE2630 Lecture Notes.
CSE 425: Data Types I Data and Data Types Data may be more abstract than their representation –E.g., integer (unbounded) vs. 64-bit int (bounded) A language.
COP4020 Programming Languages Names, Scopes, and Bindings Prof. Xin Yuan.
Data Structures Using C++ 2E Chapter 3 Pointers. Data Structures Using C++ 2E2 Objectives Learn about the pointer data type and pointer variables Explore.
Chapter 12: Pointers, Classes, Virtual Functions, and Abstract Classes.
Introduction to Java COM379 (Part-Time) University of Sunderland Harry R Erwin, PhD.
More C++ Features True object initialisation
Chapter 6 Introduction to Defining Classes. Objectives: Design and implement a simple class from user requirements. Organize a program in terms of a view.
CS 330 Programming Languages 10 / 30 / 2007 Instructor: Michael Eckmann.
Java Basics Opening Discussion zWhat did we talk about last class? zWhat are the basic constructs in the programming languages you are familiar.
Computer Organization and Design Pointers, Arrays and Strings in C Montek Singh Sep 18, 2015 Lab 5 supplement.
Objects and Variables Local variables – Confined to single context: allocated on stack – Primitive types such as int or object references – Must be initialized.
Object Oriented Software Development 4. C# data types, objects and references.
Spring 2009 Programming Fundamentals I Java Programming XuanTung Hoang Lecture No. 8.
1 Chapter 15-1 Pointers, Dynamic Data, and Reference Types Dale/Weems.
C is a high level language (HLL)
Object Oriented Programming Lecture 2: BallWorld.
Sections Basic Data Structures. 1.5 Data Structures The way you view and structure the data that your programs manipulate greatly influences your.
Memory Management in Java Mr. Gerb Computer Science 4.
Java Programming Language Lecture27- An Introduction.
Records type city is record -- Ada Name: String (1..10); Country : String (1..20); Population: integer; Capital : Boolean; end record; struct city { --
BRIEF Overview ON THE MAJOR Similarities & Differences
Chapter 6 – Data Types CSCE 343.
CS 215 Final Review Ismail abumuhfouz Fall 2014.
Java package classes Java package classes.
Lecture 2 Memory management.
Data.
Introduction to Abstract Data Types
BRIEF Overview ON THE MAJOR Similarities & Differences
Sridhar Narayan Java Basics Sridhar Narayan
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.
Lecture 2 Memory management.
SPL – PS1 Introduction to C++.
SPL – PS2 C++ Memory Handling.
Presentation transcript:

Session 1 CS-240 Data Structures Binghamton University Dick Steflik

“Java is C++ without the knives, clubs and guns”

Java vs. C++ ● Java – run-time platform independence ● only needs to be compiled once – makes deployment easier (one set of binaries) ● each platform requires a unique JVM ● different versions (SE, EE, ME) ● C++ – source levelplatform independence (sometimes) ● needs to be recompiled for each platform – compiled code is platform native code – needs platform specific install procedure – nothing like jvm required (unless using MS.Net)

Java vs. C++ ● Java – Automatic garbage collection ● objects are created via class constructors (new) ● objects are deleted as soon as they go out of scope ● C++ – garbage collection is manual ● objects are created via class constructors(new ) ● delete returns storage to storage management – destructor run automatically when object goes out of scope ● susceptible to memory leaks

Java vs. C++ ● Java – Primitives ● boolean ● int ● double ● byte ● float (IEEE) ● char (unicode) – Structured ● arrays ● vectors ● stacks ● queues ● C++ – Primitives ● bool ● byte ● short ● long ● double ● unsigned ● char (signed byte) – Structured ● arrays ● struct ● union ● enum

Java vs. C++ ● Arrays – 0 based – accessed via indexing operator [ ] – bounds checking automatically done ● no buffer overflows ● Arrays – 0 based – accesed via indexing operator [] or by pointer dereferencing – bounds checking only done by compiler option, normally not done ● buffer overflows

Java vs. C++ ● Object references – can be passed in a method call – created at instantiation ● Pointers to objects – pointers are a primitive data type ● can be manipulated via arithmetic ops ● can be used in predicate formation ● can be referenced and dereferenced

Java vs. C++ ● no operator overloading ● method overloading – unique signatures ● operator overloading – define new definitions (within a class for what an operator does ● function overloading – unique signatures

Java vs. C++ ● import – which core packages to use – compiled class files stay small ● #include – which source level packages to include in the file to be compiled – source (as seen by compiler) grows quite large – object files stay small – application must be linked via the system linker

Java vs. C++ ● Strings are a built-in class ● strings are null terminated arrays of chars – STL has string class