NDK Integration (JNI)
|
|
- Corey Thompson
- 5 years ago
- Views:
Transcription
1 NDK Integration (JNI) Lecture 6 Operating Systems Practical 9 November 2016 This work is licensed under the Creative Commons Attribution 4.0 International License. To view a copy of this license, visit OSP NDK Integration (JNI), Lecture 6 1/31
2 JNI Android JNI Example Native Method Arguments Mapping of Types Operations on Strings OSP NDK Integration (JNI), Lecture 6 2/31
3 Outline JNI Android JNI Example Native Method Arguments Mapping of Types Operations on Strings OSP NDK Integration (JNI), Lecture 6 3/31
4 JNI Java Native Interface (JNI) Native Programming Interface Allows Java code to interoperate with apps and libraries written in other programming languages When do we use JNI? Java library does not support platform-dependent features Use already existent library written in other language Time-critical code in a low level language (performance) OSP NDK Integration (JNI), Lecture 6 4/31
5 JNI Two-way interface Allows Java apps to invoke native code and vice versa OSP NDK Integration (JNI), Lecture 6 5/31
6 Two-way Interface Support for two types of native code Native libraries Call functions from native libraries In the same way they call Java methods Native applications Embed a Java VM implementation into native apps Execute components written in Java e.g. C web browser executes applets in an embedded Java VM implementation OSP NDK Integration (JNI), Lecture 6 6/31
7 Implications of Using JNI Java apps are portable Run on multiple platforms The native component will not run on multiple platforms Recompile the native code for the new platform Java is type-safe and secure C/C++ are not Misbehaving native code can affect the whole application Security checks when invoking native code Extra care when writing apps that use JNI Native methods in few classes Clean isolation between native code and Java app OSP NDK Integration (JNI), Lecture 6 7/31
8 Android NDK Android Native Development Kit Allows the embed C/C++ (native) code in Android applications Implement your own native code or use existing native libraries ndk-build Shell script that invokes the NDK build scripts Probe the development system and app project file to decide what to build Generate binaries Copy binaries in the app s project path OSP NDK Integration (JNI), Lecture 6 8/31
9 Outline JNI Android JNI Example Native Method Arguments Mapping of Types Operations on Strings OSP NDK Integration (JNI), Lecture 6 9/31
10 Basic JNI Example - Android.mk Android.mk Configuration file In /jni The name of the native source file: hello-jni.c The name of the shared library to build: hello-jni Built library: libhello-jni.so LOCAL PATH := $ ( c a l l my d i r ) i n c l u d e $ (CLEAR VARS) LOCAL MODULE := h e l l o j n i LOCAL SRC FILES := h e l l o j n i. c i n c l u d e $ (BUILD SHARED LIBRARY) OSP NDK Integration (JNI), Lecture 6 10/31
11 Basic JNI Example - Application.mk Application.mk In /jni Specifies the CPU and architecture for building In this example - all supported architectures APP ABI := a l l OSP NDK Integration (JNI), Lecture 6 11/31
12 Java source code in /src Load native library in a static initializer Declare the native function (native keyword) Call the native function package com. example. h e l l o j n i ; Basic JNI Example - Java code p u b l i c c l a s s H e l l o J n i extends A c t i v i t y O v e r r i d e p u b l i c v o i d o n C r e a t e ( Bundle s a v e d I n s t a n c e S t a t e ) { s u p e r. o n C r e a t e ( s a v e d I n s t a n c e S t a t e ) ; TextView t v = new TextView ( t h i s ) ; t v. s e t T e x t ( s t r i n g F r o m J N I ( ) ) ; s e t C o n t e n t V i e w ( t v ) ; } p u b l i c n a t i v e S t r i n g s t r i n g F r o m J N I ( ) ; s t a t i c { System. l o a d L i b r a r y ( h e l l o j n i ) ; } } OSP NDK Integration (JNI), Lecture 6 12/31
13 Basic JNI Example - Native code C source code in /jni Implements the native function Includes jni.h Function name - based on the Java function name and the path to the file containing it Arguments: JNIEnv * - pointer to the VM, called interface pointer jobject - implicit this object passed from the Java side Creates a string by using a JNI function (NewStringUTF) #i n c l u d e < s t r i n g. h> #i n c l u d e < j n i. h> j s t r i n g J a v a c o m e x a m p l e h e l l o j n i H e l l o J n i s t r i n g F r o m J N I ( JNIEnv env, j o b j e c t t h i z ) { r e t u r n ( env) >NewStringUTF ( env, H e l l o from JNI ) ; } OSP NDK Integration (JNI), Lecture 6 13/31
14 Outline JNI Android JNI Example Native Method Arguments Mapping of Types Operations on Strings OSP NDK Integration (JNI), Lecture 6 14/31
15 JNIEnv interface pointer Passed into each native method call as the first argument Valid only in the current thread (cannot be used by other threads) Points to a location that contains a pointer to a function table Each entry in the table points to a JNI function Native methods access data structures in the Java VM through JNI functions OSP NDK Integration (JNI), Lecture 6 15/31
16 JNIEnv interface pointer For C and C++ source files the syntax for calling JNI functions differs C code JNIEnv is a pointer to a JNINativeInterface structure Pointer needs to be dereferenced first JNI functions do not know the current JNI environment JNIEnv instance should be passed as the first argument to the function call e.g. return (*env)->newstringutf(env, "Hello!"); C++ code JNIEnv is a C++ class JNI functions exposed as member functions JNI functions have access to the current JNI environment e.g. return env->newstringutf("hello!"); OSP NDK Integration (JNI), Lecture 6 16/31
17 Second Argument Second argument depends whether the method is static or instance Instance methods - can be called only on a class instance Static methods - can be called directly from a static context Both can be declared as native For instance native method Reference to the object on which the method is invoked (this in C++) e.g. jobject thisobject For static native method Reference to the class in which the method is defined e.g. jclass thisclass OSP NDK Integration (JNI), Lecture 6 17/31
18 Outline JNI Android JNI Example Native Method Arguments Mapping of Types Operations on Strings OSP NDK Integration (JNI), Lecture 6 18/31
19 Mapping of Types JNI defines a set of C/C++ types corresponding to Java types Java types Primitive types: int, float, char Reference types: classes, instances, arrays The two types are treated differently by JNI int -> jint (32 bit integer) float -> jfloat (32 bit floating point number) OSP NDK Integration (JNI), Lecture 6 19/31
20 Primitive Types Java Type JNI Type C/C++ Type Size boolean jboolean unsigned char unsigned 8 bits byte jbyte char signed 8 bits char jchar unsigned short unsigned 16 bits short jshort short signed 16 bits int jint int signed 32 bits long jlong long long signed 64 bits float jfloat float 32 bits double jdouble double 64 bits OSP NDK Integration (JNI), Lecture 6 20/31
21 Objects Objects -> opaque references C pointer to internal data structures in the Java VM Objects accessed using JNI functions (JNIEnv interface pointer) e.g. GetStringUTFChars() function for accessing the contents of a string All JNI references have type jobject All reference types are subtypes of jobject Correspond to the most used types in Java jstring, jobjectarray, etc. OSP NDK Integration (JNI), Lecture 6 21/31
22 Reference Types Java Type java.lang.class java.lang. String java.lang.throwable other objects java.lang.object[] boolean[] byte[] char[] short[] int[] long[] float[] double[] other arrays Native Type jclass jstring jthrowable jobject jobjectarray jbooleanarray jbytearray jchararray jshortarray jintarray jlongarray jfloatarray jdoublearray jarray OSP NDK Integration (JNI), Lecture 6 22/31
23 Outline JNI Android JNI Example Native Method Arguments Mapping of Types Operations on Strings OSP NDK Integration (JNI), Lecture 6 23/31
24 String Types String is a reference type in JNI (jstring) Cannot be used directly as native C strings Need to convert the Java string references into C strings and back No function to modify the contents of a Java string (immutable objects) JNI supports UTF-8 and UTF-16/Unicode encoded strings UTF-8 compatible with 7-bit ASCII UTF-8 strings terminated with \0 char UTF-16/Unicode Two sets of functions jstring is represented in Unicode in the VM OSP NDK Integration (JNI), Lecture 6 24/31
25 Convert C String to Java String NewStringUTF, NewString jstring javastring = env->newstringutf("hello!"); Takes a C string, returns a Java string reference type If the VM cannot allocate memory Returns NULL OutOfMemoryError exception thrown in the VM Native code should not continue OSP NDK Integration (JNI), Lecture 6 25/31
26 Convert Java String to C String GetStringUTFChars, GetStringChars const jbyte* str = env->getstringutfchars(javastring, &iscopy); const jchar* str = env->getstringchars(javastring, &iscopy); iscopy JNI_TRUE - returned string is a copy of the chars in the original instance JNI_FALSE - returned string is a direct pointer to the original instance (pinned object in heap) Pass NULL if it s not important If the string contains only 7-bit ASCII chars you can use printf If the memory allocation fails it returns NULL, throws OutOfMemory exception OSP NDK Integration (JNI), Lecture 6 26/31
27 Release Strings Free memory occupied by the C string ReleaseStringUTFChars, ReleaseStringChars env->releasestringutfchars(javastring, str); String should be released after it is used Avoid memory leaks Frees the copy or unpins the instance (copy or not) OSP NDK Integration (JNI), Lecture 6 27/31
28 Length and Copy in Buffer Get string length GetStringUTFLength/GetStringLength on the jstring Or strlen on the GetStringUTFChars result Copy string elements into a preallocated buffer env->getstringutfregion(javastring, 0, len, buffer); start index and length length can be obtained with GetStringLength buffer is char[] No memory allocation, no out-of-memory checks OSP NDK Integration (JNI), Lecture 6 28/31
29 Critical Region GetStringCritical, ReleaseStringCritical Increase the probability to obtain a direct pointer to the string Critical Section between the calls Must not make blocking operations Must not allocate new objects in the Java VM Disable garbage collection when holding a direct pointer to a string Blocking operations or allocating objects may lead to deadlock No GetStringUTFCritical -> usually makes a copy of the string OSP NDK Integration (JNI), Lecture 6 29/31
30 Bibliography material/jni.pdf guides/jni/spec/jnitoc.html guides/jni/spec/functions.html perf-jni.html Onur Cinar, Pro Android C++ with the NDK, Chapter 3 Sylvain Ratabouil, Android NDK, Beginner s Guide, Chapter 3 OSP NDK Integration (JNI), Lecture 6 30/31
31 Keywords Java Native Interface Two-way interface Native methods Interface pointer Static methods Instance methods Primitive types Reference types JNI functions Opaque reference Java string reference Conversion operations OSP NDK Integration (JNI), Lecture 6 31/31
Lecture 5 - NDK Integration (JNI)
Lecture 5 - NDK Integration (JNI) This work is licensed under the Creative Commons Attribution 4.0 International License. To view a copy of this license, visit http://creativecommons.org/licenses/by/4.0/
More informationLecture 6 - NDK Integration (JNI)
Lecture 6 - NDK Integration (JNI) This work is licensed under the Creative Commons Attribution 4.0 International License. To view a copy of this license, visit http://creativecommons.org/licenses/by/4.0/
More informationInvoking Native Applications from Java
2012 Marty Hall Invoking Native Applications from Java Originals of Slides and Source Code for Examples: http://courses.coreservlets.com/course-materials/java.html Customized Java EE Training: http://courses.coreservlets.com/
More informationWe can also throw Java exceptions in the native code.
4. 5. 6. 7. Java arrays are handled by JNI as reference types. We have two types of arrays: primitive and object arrays. They are treated differently by JNI. Primitive arrays contain primitive data types
More informationEMBEDDED SYSTEMS PROGRAMMING Android NDK
EMBEDDED SYSTEMS PROGRAMMING 2014-15 Android NDK WHAT IS THE NDK? The Android NDK is a set of cross-compilers, scripts and libraries that allows to embed native code into Android applications Native code
More informationPorting Guide - Moving Java applications to 64-bit systems. 64-bit Java - general considerations
Porting Guide - Moving Java applications to 64-bit systems IBM has produced versions of the Java TM Developer Kit and Java Runtime Environment that run in true 64-bit mode on 64-bit systems including IBM
More informationCalling C Function from the Java Code Calling Java Method from C/C++ Code
Java Native Interface: JNI Calling C Function from the Java Code Calling Java Method from C/C++ Code Calling C Functions From Java Print Hello Native World HelloNativeTest (Java) HelloNative.c HelloNative.h
More informationJAVA Native Interface
CSC 308 2.0 System Development with Java JAVA Native Interface Department of Statistics and Computer Science Java Native Interface Is a programming framework JNI functions written in a language other than
More informationEMBEDDED SYSTEMS PROGRAMMING Android NDK
EMBEDDED SYSTEMS PROGRAMMING 2015-16 Android NDK WHAT IS THE NDK? The Android NDK is a set of cross-compilers, scripts and libraries that allows to embed native code into Android applications Native code
More informationJava TM Native Methods. Rex Jaeschke
Java TM Native Methods Rex Jaeschke Java Native Methods 1999, 2007, 2009 Rex Jaeschke. All rights reserved. Edition: 2.0 (matches JDK1.6/Java 2) All rights reserved. No part of this publication may be
More informationStudy on Programming by Combining Java with C++ Based on JNI
doi: 10.14355/spr.2016.05.003 Study on Programming by Combining Java with C++ Based on JNI Tan Qingquan 1, Luo Huachun* 2, Jiang Lianyan 3, Bo Tao 4, Liu Qun 5, Liu Bo 6 Earthquake Administration of Beijing
More informationLEVERAGING EXISTING PLASMA SIMULATION CODES. Anna Malinova, Vasil Yordanov, Jan van Dijk
136 LEVERAGING EXISTING PLASMA SIMULATION CODES Anna Malinova, Vasil Yordanov, Jan van Dijk Abstract: This paper describes the process of wrapping existing scientific codes in the domain of plasma physics
More informationJNI C++ integration made easy
JNI C++ integration made easy Evgeniy Gabrilovich gabr@acm.org Lev Finkelstein lev@zapper.com Abstract The Java Native Interface (JNI) [1] provides interoperation between Java code running on a Java Virtual
More informationSUB CODE:IT0407 SUB NAME:INTEGRATIVE PROGRAMMING & TECHNOLOGIES SEM : VII. N.J.Subashini Assistant Professor,(Sr. G) SRM University, Kattankulathur
SUB CODE:IT0407 SUB NAME:INTEGRATIVE PROGRAMMING & TECHNOLOGIES SEM : VII N.J.Subashini Assistant Professor,(Sr. G) SRM University, Kattankulathur 1 UNIT I 2 UNIT 1 LANGUAGE INTEROPERABILITY IN JAVA 9
More informationJava Native Interface. Diego Rodrigo Cabral Silva
Java Native Interface Diego Rodrigo Cabral Silva Overview The JNI allows Java code that runs within a Java Virtual Machine (VM) to operate with applications and libraries written in other languages, such
More informationAndroid NDK. Federico Menozzi & Srihari Pratapa
Android NDK Federico Menozzi & Srihari Pratapa Resources C++ CMake https://cmake.org/cmake-tutorial/ http://mathnathan.com/2010/07/getting-started-with-cmake/ NDK http://www.cplusplus.com/doc/tutorial/
More informationEMBEDDED SYSTEMS PROGRAMMING Android NDK
EMBEDDED SYSTEMS PROGRAMMING 2017-18 Android NDK WHAT IS THE NDK? The Android NDK is a set of cross-compilers, scripts and libraries that allows to embed native code into Android applications Native code
More informationColor Calibration in ERS-210
Color Calibration in ERS- Carl Axelsson Jens Törner October Examensarbete, p, Institutionen för datavetenskap, Naturvetenskapliga fakulteten; Lunds universitet. Thesis for a diploma in computer science,
More informationRenderscript. Lecture May Android Native Development Kit. NDK Renderscript, Lecture 10 1/41
Renderscript Lecture 10 Android Native Development Kit 6 May 2014 NDK Renderscript, Lecture 10 1/41 RenderScript RenderScript Compute Scripts RenderScript Runtime Layer Reflected Layer Memory Allocation
More informationLectures 5-6: Introduction to C
Lectures 5-6: Introduction to C Motivation: C is both a high and a low-level language Very useful for systems programming Faster than Java This intro assumes knowledge of Java Focus is on differences Most
More informationSelected Java Topics
Selected Java Topics Introduction Basic Types, Objects and Pointers Modifiers Abstract Classes and Interfaces Exceptions and Runtime Exceptions Static Variables and Static Methods Type Safe Constants Swings
More information1 Shyam sir JAVA Notes
1 Shyam sir JAVA Notes 1. What is the most important feature of Java? Java is a platform independent language. 2. What do you mean by platform independence? Platform independence means that we can write
More informationJPype Documentation. Release Steve Menard, Luis Nell and others
JPype Documentation Release 0.6.3 Steve Menard, Luis Nell and others Jun 03, 2018 Contents 1 Parts of the documentation 3 1.1 Installation................................................ 3 1.2 User Guide................................................
More informationJPype Documentation. Release Steve Menard, Luis Nell and others
JPype Documentation Release 0.5.4.5 Steve Menard, Luis Nell and others March 09, 2014 Contents 1 Parts of the documentation 3 1.1 Installation................................................ 3 1.2 User
More informationIntroduction to Java
Introduction to Java Module 1: Getting started, Java Basics 22/01/2010 Prepared by Chris Panayiotou for EPL 233 1 Lab Objectives o Objective: Learn how to write, compile and execute HelloWorld.java Learn
More informationLectures 5-6: Introduction to C
Lectures 5-6: Introduction to C Motivation: C is both a high and a low-level language Very useful for systems programming Faster than Java This intro assumes knowledge of Java Focus is on differences Most
More informationChapter 1 GETTING STARTED. SYS-ED/ Computer Education Techniques, Inc.
Chapter 1 GETTING STARTED SYS-ED/ Computer Education Techniques, Inc. Objectives You will learn: Java platform. Applets and applications. Java programming language: facilities and foundation. Memory management
More informationShort Notes of CS201
#includes: Short Notes of CS201 The #include directive instructs the preprocessor to read and include a file into a source code file. The file name is typically enclosed with < and > if the file is a system
More informationCS201 - Introduction to Programming Glossary By
CS201 - Introduction to Programming Glossary By #include : The #include directive instructs the preprocessor to read and include a file into a source code file. The file name is typically enclosed with
More informationNDK OVERVIEW OF THE ANDROID NATIVE DEVELOPMENT KIT
ANDROID NDK OVERVIEW OF THE ANDROID NATIVE DEVELOPMENT KIT Peter R. Egli INDIGOO.COM 1/16 Contents 1. What you can do with NDK 2. When to use native code 3. Stable APIs to use / available libraries 4.
More informationMaking use of Android
What else can you do with Android? Chris Simmonds, 2net Limited Class TU-3.2 Copyright 2010, 2net Limited 1 Overview Creating a project Writing the app Writing native code libraries Other native code 2
More informationChapter 1 INTRODUCTION SYS-ED/ COMPUTER EDUCATION TECHNIQUES, INC.
hapter 1 INTRODUTION SYS-ED/ OMPUTER EDUATION TEHNIQUES, IN. Objectives You will learn: Java features. Java and its associated components. Features of a Java application and applet. Java data types. Java
More informationC Programming. Course Outline. C Programming. Code: MBD101. Duration: 10 Hours. Prerequisites:
C Programming Code: MBD101 Duration: 10 Hours Prerequisites: You are a computer science Professional/ graduate student You can execute Linux/UNIX commands You know how to use a text-editing tool You should
More informationAndroid: Call C Functions with the Native Development Kit (NDK)
ARL-TN-0782 SEP 2016 US Army Research Laboratory Android: Call C Functions with the Native Development Kit (NDK) by Hao Q Vu NOTICES Disclaimers The findings in this report are not to be construed as an
More informationProgramming refresher and intro to C programming
Applied mechatronics Programming refresher and intro to C programming Sven Gestegård Robertz sven.robertz@cs.lth.se Department of Computer Science, Lund University 2018 Outline 1 C programming intro 2
More informationCPSC 3740 Programming Languages University of Lethbridge. Data Types
Data Types A data type defines a collection of data values and a set of predefined operations on those values Some languages allow user to define additional types Useful for error detection through type
More informationThe Java Native Interface. Programmer s Guide and Specification
The Java Native Interface Programmer s Guide and Specification The Java Native Interface Programmer s Guide and Specification Sheng Liang ADDISON-WESLEY An imprint of Addison Wesley Longman, Inc. Reading,
More informationProgramming. Syntax and Semantics
Programming For the next ten weeks you will learn basic programming principles There is much more to programming than knowing a programming language When programming you need to use a tool, in this case
More informationArray. Prepared By - Rifat Shahriyar
Java More Details Array 2 Arrays A group of variables containing values that all have the same type Arrays are fixed length entities In Java, arrays are objects, so they are considered reference types
More informationCompiling Techniques
Lecture 10: Introduction to 10 November 2015 Coursework: Block and Procedure Table of contents Introduction 1 Introduction Overview Java Virtual Machine Frames and Function Call 2 JVM Types and Mnemonics
More information1 class HelloWorld 2 { 3 public native void displayhelloworld(); 4 static 5 { 6 System.loadLibrary("hello"); 7 }
JNI Java Native Interface C and C++. JNI and STL Alan Mycroft University of Cambridge (heavily based on previous years notes thanks to Alastair Beresford and Andrew Moore) Michaelmas Term 2012 20 Java
More informationC and C++ 8. JNI and STL. Alan Mycroft. University of Cambridge (heavily based on previous years notes thanks to Alastair Beresford and Andrew Moore)
C and C++ 8. JNI and STL Alan Mycroft University of Cambridge (heavily based on previous years notes thanks to Alastair Beresford and Andrew Moore) Michaelmas Term 2013 2014 1 / 41 JNI and STL This lecture
More informationJNI and STL. Justification
JNI and STL C and C++. JNI and STL Alan Mycroft University of Cambridge (heavily based on previous years notes thanks to Alastair Beresford and Andrew Moore) Michaelmas Term 2013 201 This lecture looks
More informationVARIABLES AND TYPES CITS1001
VARIABLES AND TYPES CITS1001 Scope of this lecture Types in Java the eight primitive types the unlimited number of object types Values and References The Golden Rule Primitive types Every piece of data
More informationNotes of the course - Advanced Programming. Barbara Russo
Notes of the course - Advanced Programming Barbara Russo a.y. 2014-2015 Contents 1 Lecture 2 Lecture 2 - Compilation, Interpreting, and debugging........ 2 1.1 Compiling and interpreting...................
More information20 Most Important Java Programming Interview Questions. Powered by
20 Most Important Java Programming Interview Questions Powered by 1. What's the difference between an interface and an abstract class? An abstract class is a class that is only partially implemented by
More informationLecture 14. No in-class files today. Homework 7 (due on Wednesday) and Project 3 (due in 10 days) posted. Questions?
Lecture 14 No in-class files today. Homework 7 (due on Wednesday) and Project 3 (due in 10 days) posted. Questions? Friday, February 11 CS 215 Fundamentals of Programming II - Lecture 14 1 Outline Static
More informationGo Forth and Code. Jonathan Gertig. CSC 415: Programing Languages. Dr. Lyle
J o n a t h a n G e r t i g P a g e 1 Go Forth and Code Jonathan Gertig CSC 415: Programing Languages Dr. Lyle 2013 J o n a t h a n G e r t i g P a g e 2 Go dogs Go or A Brief History of Go 6 years ago
More informationEMBEDDED SYSTEMS PROGRAMMING Language Basics
EMBEDDED SYSTEMS PROGRAMMING 2015-16 Language Basics "The tower of Babel" by Pieter Bruegel the Elder Kunsthistorisches Museum, Vienna (PROGRAMMING) LANGUAGES ABOUT THE LANGUAGES C (1972) Designed to replace
More informationPrinceton University. Computer Science 217: Introduction to Programming Systems. Data Types in C
Princeton University Computer Science 217: Introduction to Programming Systems Data Types in C 1 Goals of C Designers wanted C to: Support system programming Be low-level Be easy for people to handle But
More informationIndex. object lifetimes, and ownership, use after change by an alias errors, use after drop errors, BTreeMap, 309
A Arithmetic operation floating-point arithmetic, 11 12 integer numbers, 9 11 Arrays, 97 copying, 59 60 creation, 48 elements, 48 empty arrays and vectors, 57 58 executable program, 49 expressions, 48
More informationModern Programming Languages. Lecture Java Programming Language. An Introduction
Modern Programming Languages Lecture 27-30 Java Programming Language An Introduction 107 Java was developed at Sun in the early 1990s and is based on C++. It looks very similar to C++ but it is significantly
More informationPointers, Arrays, and Strings. CS449 Spring 2016
Pointers, Arrays, and Strings CS449 Spring 2016 Pointers Pointers are important. Pointers are fun! Pointers Every variable in your program has a memory location. This location can be accessed using & operator.
More informationProcedural Programming & Fundamentals of Programming
Procedural Programming & Fundamentals of Programming Lecture 3 - Summer Semester 2018 & Joachim Zumbrägel What we know so far... Data type serves to organize data (in the memory), its possible values,
More informationJava Overview An introduction to the Java Programming Language
Java Overview An introduction to the Java Programming Language Produced by: Eamonn de Leastar (edeleastar@wit.ie) Dr. Siobhan Drohan (sdrohan@wit.ie) Department of Computing and Mathematics http://www.wit.ie/
More informationAn overview of Java, Data types and variables
An overview of Java, Data types and variables Lecture 2 from (UNIT IV) Prepared by Mrs. K.M. Sanghavi 1 2 Hello World // HelloWorld.java: Hello World program import java.lang.*; class HelloWorld { public
More informationB.V. Patel Institute of BMC & IT, UTU 2014
BCA 3 rd Semester 030010301 - Java Programming Unit-1(Java Platform and Programming Elements) Q-1 Answer the following question in short. [1 Mark each] 1. Who is known as creator of JAVA? 2. Why do we
More informationP. O. Box 1565 Cupertino, CA USA
INTERNATIONAL J CONSORTIUM Draft SPECIFICATION JEFF File Format. P. O. Box 1565 Cupertino, CA 95015-1565 USA www.j-consortium.org Copyright 2000, 2002, J Consortium, All rights reserved Permission is granted
More informationComputers Programming Course 5. Iulian Năstac
Computers Programming Course 5 Iulian Năstac Recap from previous course Classification of the programming languages High level (Ada, Pascal, Fortran, etc.) programming languages with strong abstraction
More informationIntroduction to Programming Using Java (98-388)
Introduction to Programming Using Java (98-388) Understand Java fundamentals Describe the use of main in a Java application Signature of main, why it is static; how to consume an instance of your own class;
More informationPoints To Remember for SCJP
Points To Remember for SCJP www.techfaq360.com The datatype in a switch statement must be convertible to int, i.e., only byte, short, char and int can be used in a switch statement, and the range of the
More informationJava/JMDL communication with MDL applications
m with MDL applications By Stanislav Sumbera [Editor Note: The arrival of MicroStation V8 and its support for Microsoft Visual Basic for Applications opens an entirely new set of duallanguage m issues
More informationJOURNAL OF OBJECT TECHNOLOGY
JOURNAL OF OBJECT TECHNOLOGY Online at www.jot.fm. Published by ETH Zurich, Chair of Software Engineering JOT, 2002 Vol. 1, no. 4, September-October 2002 Easing the Transition from C++ to Java (Part 2)
More informationAP COMPUTER SCIENCE JAVA CONCEPTS IV: RESERVED WORDS
AP COMPUTER SCIENCE JAVA CONCEPTS IV: RESERVED WORDS PAUL L. BAILEY Abstract. This documents amalgamates various descriptions found on the internet, mostly from Oracle or Wikipedia. Very little of this
More informationECE 122. Engineering Problem Solving with Java
ECE 122 Engineering Problem Solving with Java Lecture 4 Creating and Using Objects Outline Problem: How do I create multiple objects from a class Java provides a number of built-in classes for us Understanding
More informationECE 122. Engineering Problem Solving with Java
ECE 122 Engineering Problem Solving with Java Lecture 4 Creating and Using Objects Outline Problem: How do I create multiple objects from a class Java provides a number of built-in classes for us Understanding
More informationLecture 03 Bits, Bytes and Data Types
Lecture 03 Bits, Bytes and Data Types Computer Languages A computer language is a language that is used to communicate with a machine. Like all languages, computer languages have syntax (form) and semantics
More informationStream Computing using Brook+
Stream Computing using Brook+ School of Electrical Engineering and Computer Science University of Central Florida Slides courtesy of P. Bhaniramka Outline Overview of Brook+ Brook+ Software Architecture
More informationSABLEJIT: A Retargetable Just-In-Time Compiler for a Portable Virtual Machine p. 1
SABLEJIT: A Retargetable Just-In-Time Compiler for a Portable Virtual Machine David Bélanger dbelan2@cs.mcgill.ca Sable Research Group McGill University Montreal, QC January 28, 2004 SABLEJIT: A Retargetable
More informationSyllabus & Curriculum for Certificate Course in Java. CALL: , for Queries
1 CONTENTS 1. Introduction to Java 2. Holding Data 3. Controllin g the f l o w 4. Object Oriented Programming Concepts 5. Inheritance & Packaging 6. Handling Error/Exceptions 7. Handling Strings 8. Threads
More informationFull file at
Java Programming, Fifth Edition 2-1 Chapter 2 Using Data within a Program At a Glance Instructor s Manual Table of Contents Overview Objectives Teaching Tips Quick Quizzes Class Discussion Topics Additional
More information3/7/2018. Sometimes, Knowing Which Thing is Enough. ECE 220: Computer Systems & Programming. Often Want to Group Data Together Conceptually
University of Illinois at Urbana-Champaign Dept. of Electrical and Computer Engineering ECE 220: Computer Systems & Programming Structured Data in C Sometimes, Knowing Which Thing is Enough In MP6, we
More informationDOWNLOAD PDF CORE JAVA APTITUDE QUESTIONS AND ANSWERS
Chapter 1 : Chapter-wise Java Multiple Choice Questions and Answers Interview MCQs Java Programming questions and answers with explanation for interview, competitive examination and entrance test. Fully
More informationSpecial Topics: Programming Languages
Lecture #23 0 V22.0490.001 Special Topics: Programming Languages B. Mishra New York University. Lecture # 23 Lecture #23 1 Slide 1 Java: History Spring 1990 April 1991: Naughton, Gosling and Sheridan (
More informationCOT 3530: Data Structures. Giri Narasimhan. ECS 389; Phone: x3748
COT 3530: Data Structures Giri Narasimhan ECS 389; Phone: x3748 giri@cs.fiu.edu www.cs.fiu.edu/~giri/teach/3530spring04.html Evaluation Midterm & Final Exams Programming Assignments Class Participation
More informationLesson 7. Reading and Writing a.k.a. Input and Output
Lesson 7 Reading and Writing a.k.a. Input and Output Escape sequences for printf strings Source: http://en.wikipedia.org/wiki/escape_sequences_in_c Escape sequences for printf strings Why do we need escape
More informationCS 261 Fall C Introduction. Variables, Memory Model, Pointers, and Debugging. Mike Lam, Professor
CS 261 Fall 2017 Mike Lam, Professor C Introduction Variables, Memory Model, Pointers, and Debugging The C Language Systems language originally developed for Unix Imperative, compiled language with static
More informationPRINCIPLES OF OPERATING SYSTEMS
PRINCIPLES OF OPERATING SYSTEMS Tutorial-1&2: C Review CPSC 457, Spring 2015 May 20-21, 2015 Department of Computer Science, University of Calgary Connecting to your VM Open a terminal (in your linux machine)
More informationCSC Java Programming, Fall Java Data Types and Control Constructs
CSC 243 - Java Programming, Fall 2016 Java Data Types and Control Constructs Java Types In general, a type is collection of possible values Main categories of Java types: Primitive/built-in Object/Reference
More information15CS45 : OBJECT ORIENTED CONCEPTS
15CS45 : OBJECT ORIENTED CONCEPTS QUESTION BANK: What do you know about Java? What are the supported platforms by Java Programming Language? List any five features of Java? Why is Java Architectural Neutral?
More informationCS 231 Data Structures and Algorithms, Fall 2016
CS 231 Data Structures and Algorithms, Fall 2016 Dr. Bruce A. Maxwell Department of Computer Science Colby College Course Description Focuses on the common structures used to store data and the standard
More informationCSCI-243 Exam 1 Review February 22, 2015 Presented by the RIT Computer Science Community
CSCI-243 Exam 1 Review February 22, 2015 Presented by the RIT Computer Science Community http://csc.cs.rit.edu History and Evolution of Programming Languages 1. Explain the relationship between machine
More informationSelected Questions from by Nageshwara Rao
Selected Questions from http://way2java.com by Nageshwara Rao Swaminathan J Amrita University swaminathanj@am.amrita.edu November 24, 2016 Swaminathan J (Amrita University) way2java.com (Nageshwara Rao)
More information[0569] p 0318 garbage
A Pointer is a variable which contains the address of another variable. Declaration syntax: Pointer_type *pointer_name; This declaration will create a pointer of the pointer_name which will point to the
More informationChapter 2: Using Data
Chapter 2: Using Data TRUE/FALSE 1. A variable can hold more than one value at a time. F PTS: 1 REF: 52 2. The legal integer values are -2 31 through 2 31-1. These are the highest and lowest values that
More informationa data type is Types
Pointers Class 2 a data type is Types Types a data type is a set of values a set of operations defined on those values in C++ (and most languages) there are two flavors of types primitive or fundamental
More informationB2.52-R3: INTRODUCTION TO OBJECT-ORIENTED PROGRAMMING THROUGH JAVA
B2.52-R3: INTRODUCTION TO OBJECT-ORIENTED PROGRAMMING THROUGH JAVA NOTE: 1. There are TWO PARTS in this Module/Paper. PART ONE contains FOUR questions and PART TWO contains FIVE questions. 2. PART ONE
More informationChapter 2 Using Data. Instructor s Manual Table of Contents. At a Glance. Overview. Objectives. Teaching Tips. Quick Quizzes. Class Discussion Topics
Java Programming, Sixth Edition 2-1 Chapter 2 Using Data At a Glance Instructor s Manual Table of Contents Overview Objectives Teaching Tips Quick Quizzes Class Discussion Topics Additional Projects Additional
More informationCS555: Distributed Systems [Fall 2017] Dept. Of Computer Science, Colorado State University
CS 555: DISTRIBUTED SYSTEMS [RMI] Frequently asked questions from the previous class survey Shrideep Pallickara Computer Science Colorado State University L21.1 L21.2 Topics covered in this lecture RMI
More informationOptimizing Your Android Applications
Optimizing Your Android Applications Alexander Nelson November 27th, 2017 University of Arkansas - Department of Computer Science and Computer Engineering The Problem Reminder Immediacy and responsiveness
More informationChapter 2. Procedural Programming
Chapter 2 Procedural Programming 2: Preview Basic concepts that are similar in both Java and C++, including: standard data types control structures I/O functions Dynamic memory management, and some basic
More informationComputer Components. Software{ User Programs. Operating System. Hardware
Computer Components Software{ User Programs Operating System Hardware What are Programs? Programs provide instructions for computers Similar to giving directions to a person who is trying to get from point
More informationC - Basics, Bitwise Operator. Zhaoguo Wang
C - Basics, Bitwise Operator Zhaoguo Wang Java is the best language!!! NO! C is the best!!!! Languages C Java Python 1972 1995 2000 (2.0) Procedure Object oriented Procedure & object oriented Compiled
More informationC++\CLI. Jim Fawcett CSE687-OnLine Object Oriented Design Summer 2017
C++\CLI Jim Fawcett CSE687-OnLine Object Oriented Design Summer 2017 Comparison of Object Models Standard C++ Object Model All objects share a rich memory model: Static, stack, and heap Rich object life-time
More informationCS321 Languages and Compiler Design I. Winter 2012 Lecture 2
CS321 Languages and Compiler Design I Winter 2012 Lecture 2 1 A (RE-)INTRODUCTION TO JAVA FOR C++/C PROGRAMMERS Why Java? Developed by Sun Microsystems (now Oracle) beginning in 1995. Conceived as a better,
More informationCS 430 Spring Mike Lam, Professor. Data Types and Type Checking
CS 430 Spring 2015 Mike Lam, Professor Data Types and Type Checking Type Systems Type system Rules about valid types, type compatibility, and how data values can be used Benefits of a robust type system
More informationVariables Data types Variable I/O. C introduction. Variables. Variables 1 / 14
C introduction Variables Variables 1 / 14 Contents Variables Data types Variable I/O Variables 2 / 14 Usage Declaration: t y p e i d e n t i f i e r ; Assignment: i d e n t i f i e r = v a l u e ; Definition
More informationCSE 333 Lecture 2 Memory
CSE 333 Lecture 2 Memory John Zahorjan Department of Computer Science & Engineering University of Washington Today s goals - some terminology - review of memory resources - reserving memory - type checking
More informationCSE 565 Computer Security Fall 2018
CSE 565 Computer Security Fall 2018 Lecture 15: Software Security II Department of Computer Science and Engineering University at Buffalo 1 Software Vulnerabilities Buffer overflow vulnerabilities account
More informationTYPES, VALUES AND DECLARATIONS
COSC 2P90 TYPES, VALUES AND DECLARATIONS (c) S. Thompson, M. Winters 1 Names, References, Values & Types data items have a value and a type type determines set of operations variables Have an identifier
More information