Computer Programming Lecture 11 이윤진서울대학교
|
|
- Peter Lee
- 6 years ago
- Views:
Transcription
1 Computer Programming Lecture 11 이윤진서울대학교
2 Slide Credits 엄현상교수님 서울대학교컴퓨터공학부 Computer Programming, g, 2007 봄학기
3 Object-Oriented Programming (2)
4 순서 Java Q&A
5 Java 개요 Object-Oriented Oriented Programming Language (OOPL) by Sun in 1991 Programming with One or More Classes Simple Structuret w/o header files, preprocessor, struct, operator overloading, multiple Inheritance, pointers, etc. Garbage Collection No need to delete or return any storage Dynamic Loading Classes being loaded d as needed d Platform Independence Java Virtual Machine (JVM) Multithreading Support for multiple threads of execution
6 Some Differences with C/C++ Automatic Memory Management Garbage Collector No Dangling gpointers or Memory Leaks No Pointer Handling No Explicit Reference/Dereference Operations No Makefiles No Header Files cf, imported Packages No Function Declaration (Similar to C) No Default Function Argument
7 Java Platform S/W Platform for Running Java - on Top of any Platforms Java Virtual Machine (JVM) Java Application Programming Interface (Java API) Java Platform Java Program Java API Java Virtual Machine Underlying Platform Collection of ready-made software components -grouped into Packages of classes and interfaces)
8 Java Interpreter Implementation of the JVM Executing Java Bytecodes Java bytecodes can be considered as intermediate code instructions for Java bytecodes can be considered as intermediate code instructions for the JVM Java programs, once compiled into bytecodes, can be run on any JVM
9 How a Java Program Runs Compilation and Interpretation Compiler First Translates a Java Program into Java Bytecodes Once Interpreter Parses and Runs Each Java Bytecode Instruction Multiple times on different platforms Java Source Code Java Bytecode Machine Code Java Compiler Java Interpreter Computer javac Java Virtual Machine (JVM)
10 Java Program Saved in Files, Each of Which Has the Same Name as the public Class Containing Only One public Class Containing Other Non-public Classes public class HelloWorld { This code must be saved in HelloWorld.java public static void main(string args[]) { System.out.println( Hello, World ); $ javac HelloWorld.java $java HelloWorld Hello, World compile (create HelloWorld.class; bytecode) start the JVM and run the main method
11 Memory Layout of a Java Program Bytecode of Method Method Area Variables in Class Parameter Variable Stack Local Variable Class Object Array Object Heap String Object Space for objects created by new operator public class MemoryModelTest { static int x=0; public static void main(string args[]) { int a=10, b=20, c; c = add(a, b); static int add(int a, int b) { return(a + b); Sample Program: MemoryModelTest.java
12 Class Unit of Programming Java Program: a Collection of Classes Source code in.java files Description (Blueprint) of Objects (Instances) Common Characteristics Instances Have These Characteristics Attributes (Data Fields) for Each Object Methods (Operations) That Work on the Objects
13 Member Access Control Way to Control Access to a Class Members from Other Classes private Accessible only in the class itself Default (package or friendly) Accessible in the same-package subclasses of the class or in the classes of the same package protected Accessible in the subclasses of the class or in the classes of the same package public Accessible everywhere
14 Object Instance of a Class Uniquely Identifiable Entity w/ Its State, Behavior, and Interface Maintaining Data Values in Its Attributes Referenced by a Reference Variable (of Reference Type) Inheriting from the Class Object w/ a number of methods tostring(), equals(), &, clone()
15 Managing Objects Referencing Objects of Specified Types Objects Created by the new Operator Creating Objects by Executing the Constructors Constructor (Function) Overloading String greeting = new String( hello ); greeting String value = hello Dlti Deleting Objects via Garbage Collection Cll Reference Count for Each Object Cleanup occurs at the convenience of the Java runtime environment
16 Java Example: Abstraction Online Retailer Such as Amazon.Com Item: Type, Title, Maker, Price, Availability, etc. class Item { // Class definition public String title; public double price; Attribute of the class // String is a predefined class // double is a primitive data type public double SalePrice(){ return (price * 0.9); Method of the class Item A = new Item(); // Class object definition and creation Variable of reference type // OKAY : A.title, A.price, and A.SalePrice()
17 Java Example: Encapsulation Online Retailer Example Cont d class Item { public String title; public double price; private int instockquantity; public double SalePrice(){ return (price * 0.9); public boolean isavailable(){ if(instockquantity > 0) return true; else return false; instockquantity attribute is not accessible outside of the Item class Item A = new Item(); // Class object definition and creation // NOT OKAY: A.inStockQuantity // OKAY: A.isAvailable()
18 Java Example: Inheritance Online Retailer Example Cont d class MusicCDItem extends Item { public String singer_name; // Class object definition and creation MusicCDItem B = new MusicCDItem; Item MusicCDItem // OKAY: B.singer_name, B.title, B.price, B.SalePrice(), // and B.isAvailable() // NOT OKAY: B.inStockQuantity
19 Java Example: Polymorphism Online Retailer Example Cont d class Item { public String title; public double price; private int instockquantity; public double SalePrice(){ return (price * 0.9); public boolean isavailable(){ if(instockquantity > 0) return true; else return rn false; public void specificinfo() { System.out.println("no info: a base-class object");
20 Java Example: Polymorphism Cont d Online Retailer Example Cont d class MusicCDItem extends Item { public String singer_name; public void specificinfo(){ System.out.println("signer name=" + singer_name + " : a derived-class object"); public class OnlineRetailer { static void printspecificinfo(item Item){item.specificInfo(); public static void main(string args[]){ Item A = new Item(); MusicCDItem B = new MusicCDItem(); printspecificinfo(a); // Call Item.specificInfo() printspecificinfo(b); // Call MusicCDItem.specificInfo() // - Another derived class (e.g., MovieDVDItem) with specificinfo()
21 Static Modifier Use: Static Attributes & Static Methods Features All Classes Share Static Members It Is Possible to Invoke Static Methods w/o Instantiation In Static ti Methods, It Is Allowed to Access Non-Static ti Data or Non-Static Methods of Classes after the Instantiation of the Objects class A{ private int i = 5; public static printi(){ System.out.println(i); System.out.println(new A().i); // error!
22 Static Modifier Cont d Differences between C++ and Java Static Method Invocation C++ : Class::method(); Java : Class.method(); Static Data Member Initialization C++ : No In-Class Initialization (ANSI/ISO) Java : In-Class Initialization class A{ public: static int i; // declare int A::i = 0; // define & initialize C++ class A{ public static int i = 10; JAVA
23 Windows API
24 순서 Introduction to Windows What is Windows API? Application Development Environments Message Driven System Other Backgrounds Function WinMain Function WndProc API Example : Hello, World! Possible Topics for Final
25 Introduction to Windows History of Windows Windows Windows Windows Windows NT Windows Windows NT Windows Windows Windows XP 07.1 Windows Vista
26 Introduction to Windows Cont d Merits Being the Most Widely Used in Personal Computing GUI : Graphic User Interface Multitasking Standard User Interface User Adapts to New Program Quickly Demerits Very Commercial Product! Not Open Source!
27 [ 참고 ] X Windows : Standard Graphical Engine for Unix/Linux Difference with Microsoft Windows Platform Independent Network Transparent X Protocol o Provide a client-server architecture at the application level o Separate the processing and display for an application - X Server : Low-level interface for controlling screen - X Client : Processing part of the application
28 What is Windows API? API (Application i Programming Interface) Possibly Making Windows System Calls Application 1 Hardware 1 Hardware 2 Windows API Application 2 Windows Application 3
29 Application Development Environments Windows Software Development Kit (SDK) : Providing API Libraries, Documents, Tools, etc. Using API Directly High Performance, Fine-Grain Control Low Productivity Class Libraries Wrapping APIs to Classes Convenient and Powerful E.g., g, MFC (Microsoft Foundation Class) for Visual C++ Rapid Application Development (RAD) Tools Providing Users Don t-care Visual Tools High Productivity, but Low Performance E.g., Visual Basic, Delphi, Power Builder, etc.
30 Message Driven System Content of a Message Event Information Change in the System Change between the User and System (User) Action in a Window Role of OS Regarding a Message Inspecting What Events Have Occurred, and Generating the Corresponding Message Enqueuing the Message into a Message Queue Belonging to Each Program
31 Message Driven System Cont d Use of a Message Queue Each Program Has a Message Queue Function WndProc Processes a Message message queue detect generate OS message enqueue an action
32 Message Driven System Cont d Use of the Message Loop Location End of Function WinMain Functionality Dequeuing from the Message Queue Translating If Necessary Delivering to the Event Handler
33 Message Driven System Cont d return false if getting a WM_QUIT message, else return true translate a keyboard input message e.g.,) WM_KEYDOWN & WM_KEYUP WM_CHAR int APIENTRY WinMain( ){ while(getmessage(&message, 0, 0, 0)){ TranslateMessage(&message); DispatchMessage(&message); deliver the message to function WndProc that specifies what to do
34 Message Driven System Cont d OS Application WinMain message queue while(getmessage(&message, 0, 0, 0)){ TranslateMessage(&message); DispatchMessage(&message); WM_PAINT WM_CHAR WndProc switch(message){ case WM_CHAR: break; case default: return DefWindowProc();
35 Other Backgrounds Handles : Variables Distinguishable from Other Resources 32 bit Integer Type Value Those Made by OS, Not the Users Similarly, fd=open() p in Linux Types : HWND, HPEN, HBRUSH, HDC, etc. Represent a Handle of Each Resource
36 Other Backgrounds Cont d Way for Printing Application Win32 API G D I Device Driver Graphic Device Interface Output Device
37 Other Backgrounds Cont d Printing Procedure Get a device context handle for printing on screen HDC hdc = GetDC(hWnd); Print out using the handle via GDI TextOut(hDC,0,0, Hello,5); LineTo(hDC,100,100); 100); : current window instance Release the device context handle ReLeaseDC(hWnd,hDC); hdc)
38 Function WinMain Entry Point of Program Similar to int main(int, char**); int APIENTRY WinMain(HINSTANCE hinstance, HINSTANCE hprevinstance, LPSTR lpszcmdparam, int ncmdshow); hinstance hprevinstance lpszcmdparam ncmdshow Instance handle of window Previous instance handle Currently this is always NULL Command arguments (like argv) Shape of program (minimize, normal, maximize, )
39 Function WinMain Cont d start create & register a window class create a window show the window get a message dispatch a message translate a message WM_QUIT false true end
40 Function WndProc Window Procedure Specify What to Do When an Event Occurs LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam); hwnd message wparam lparam Instance handle of window Types of message Additional information of message (different according to message)
41 API Example : Hello, World! Using MS Visual C++ 6.0
42 API Example : Hello, World! Cont d Make a Workspace for the Example Create a Project Select menu : File New Projects specify the project name select Win32 select Win32 Application
43 API Example : Hello, World! Cont d Select a Default Skeleton Code empty code a simple program : having empty functions (WinMain, WndProc, ) a simple program : displaying Hello World! and having a simple menu
44 API Example : Hello, World! Cont d Add a New Source File into the Project Select menu : File New Files select C++ Source File specify the source file name
45 API Example : Hello, World! Cont d Source Code #include <windows.h> LRESULT CALLBACK WndProc(HWND,UINT,WPARAM,LPARAM); HINSTANCE g_hinst; LPSTR lpszclass="hello, World!"; program title int APIENTRY WinMain(HINSTANCE hinstance,hinstance hprevinstance,lpstr lpszcmdparam,int ncmdshow) { HWND hwnd; MSG Message; WNDCLASS WndClass; g_hinst=hinstance;
46 register a window class SH); create a window OW, API Example : Hello, World! Cont d WndClass.cbClsExtra=0; WndClass.cbWndExtra=0; WndClass.hbrBackground=(HBRUSH)GetStockObject(WHITE_BRU WndClass.hCursor=LoadCursor(NULL,IDC_ARROW); WndClass.hIcon=LoadIcon(NULL,IDI_APPLICATION); WndClass.hInstance=hInstance; WndClass.lpfnWndProc=(WNDPROC)WndProc; WndClass.lpszClassName=lpszClass; register the WndClass.lpszMenuName=NULL; WndClass.style=CS_HREDRAW CS_VREDRAW; RegisterClass(&WndClass); dispatch procedure hwnd=createwindow(lpszclass,lpszclass,ws_overlappedwind CW_USEDEFAULT,CW_USEDEFAULT,CW_USEDEFAULT, CW_USEDEFAULT,NULL,(HMENU)NULL,hInstance,NULL); ShowWindow(hWnd,nCmdShow);
47 API Example : Hello, World! Cont d while(getmessage(&message,0,0,0)) (&M g 0 0)) { TranslateMessage(&Message); DispatchMessage(&Message); return Message.wParam; message loop
48 API Example : Hello, World! Cont d LRESULT CALLBACK WndProc(HWND hwnd,uint message, WPARAM wparam,lparam lparam) { switch(message) { case WM_DESTROY: PostQuitMessage(0); break; case WM_PAINT: HDC hdc; PAINTSTRUCT ps; send WM_QUIT hdc = BeginPaint(hWnd, &ps); to itself TextOut(hDC, 10, 10," Hello, World!", 14); EndPaint(hWnd, &ps); break; default: return DefWindowProc(hWnd,message,wParam,lParam); return 0; when a window needs repaint pass the message to the default window procedure by default
49 API Example : Hello, World! Cont d Compilation Ctrl+F7 : Compile a Source File F7 : Build a Executable File Ctrl+F5 : Build and Execute the Program without Debugging F5 : Build and Execute the Program with Debugging compile (Ctrl+F7) build (F7) execute the program (Ctrl+F5) go (F5)
50 Possible Topics for Final Unix/Linux C Program Memory Layout File System Interprocess Communication Utilities and Editors Emacs Batch and Shell Programming C Complier and Linker Static vs Shared Library Gdb & Make Modularity and Abstraction in C Software Modular Design
51 Possible Topics for Final Cont d Scoping C Pointers Call by Reference Memory Management in C Possible Errors in Dynamic Memory Allocation Libraries Standard I/O Library Object-Oriented Programming Design Principles C, C++, or Java Programming Static
엄현상 (Eom, Hyeonsang) School of Computer Science and Engineering Seoul National University COPYRIGHTS 2017 EOM, HYEONSANG ALL RIGHTS RESERVED
엄현상 (Eom, Hyeonsang) School of Computer Science and Engineering Seoul National University COPYRIGHTS 2017 EOM, HYEONSANG ALL RIGHTS RESERVED Outline - Questionnaire Results - Java Overview - Java Examples
More informationProgramming in graphical environment. Introduction
Programming in graphical environment Introduction The lecture Additional resources available at: http://www.mini.pw.edu.pl/~maczewsk/windows_2004 Recommended books: Programming Windows - Charles Petzold
More informationWindows Programming. 1 st Week, 2011
Windows Programming 1 st Week, 2011 시작하기 Visual Studio 2008 새프로젝트 파일 새로만들기 프로젝트 Visual C++ 프로젝트 Win32 프로젝트 빈프로젝트 응용프로그램설정 Prac01 솔루션 새항목추가 C++ 파일 main.cpp main0.cpp cpp 다운로드 솔루션빌드 오류 Unicode vs. Multi-Byte
More informationWe display some text in the middle of a window, and see how the text remains there whenever the window is re-sized or moved.
1 Programming Windows Terry Marris January 2013 2 Hello Windows We display some text in the middle of a window, and see how the text remains there whenever the window is re-sized or moved. 2.1 Hello Windows
More information엄현상 (Eom, Hyeonsang) School of Computer Science and Engineering Seoul National University COPYRIGHTS 2015 EOM, HYEONSANG ALL RIGHTS RESERVED
엄현상 (Eom, Hyeonsang) School of Computer Science and Engineering Seoul National University COPYRIGHTS 2015 EOM, HYEONSANG ALL RIGHTS RESERVED Outline - Object Oriented Programming (OOP) - Basic Terms -
More informationWindow programming. Programming
Window programming 1 Objectives Understand the mechanism of window programming Understand the concept and usage of of callback functions Create a simple application 2 Overview Windows system Hello world!
More informationChapter 15 Programming Paradigm
Chapter 15 Programming Paradigm A Windows program, like any other interactive program, is for the most part inputdriven. However, the input of a Windows program is conveniently predigested by the operating
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 informationAdvantech Windows CE.net Application Hand on Lab
Advantech Windows CE.net Application Hand on Lab Lab : Serial Port Communication Objectives After completing this lab, you will be able to: Create an application to open, initialize the serial port, and
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 informationLSN 4 GUI Programming Using The WIN32 API
LSN 4 GUI Programming Using The WIN32 API ECT362 Operating Systems Department of Engineering Technology LSN 4 Why program GUIs? This application will help introduce you to using the Win32 API Gain familiarity
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 informationProgramming Language Concepts: Lecture 2
Programming Language Concepts: Lecture 2 Madhavan Mukund Chennai Mathematical Institute madhavan@cmi.ac.in http://www.cmi.ac.in/~madhavan/courses/pl2011 PLC 2011, Lecture 2, 6 January 2011 Classes and
More informationJava for Programmers Course (equivalent to SL 275) 36 Contact Hours
Java for Programmers Course (equivalent to SL 275) 36 Contact Hours Course Overview This course teaches programmers the skills necessary to create Java programming system applications and satisfies the
More informationOutline. Java Models for variables Types and type checking, type safety Interpretation vs. compilation. Reasoning about code. CSCI 2600 Spring
Java Outline Java Models for variables Types and type checking, type safety Interpretation vs. compilation Reasoning about code CSCI 2600 Spring 2017 2 Java Java is a successor to a number of languages,
More informationLecture 1: Overview of Java
Lecture 1: Overview of Java What is java? Developed by Sun Microsystems (James Gosling) A general-purpose object-oriented language Based on C/C++ Designed for easy Web/Internet applications Widespread
More informationIntroduction to Visual Basic and Visual C++ Introduction to Java. JDK Editions. Overview. Lesson 13. Overview
Introduction to Visual Basic and Visual C++ Introduction to Java Lesson 13 Overview I154-1-A A @ Peter Lo 2010 1 I154-1-A A @ Peter Lo 2010 2 Overview JDK Editions Before you can write and run the simple
More informationThe Java programming environment. The Java programming environment. Java: A tiny intro. Java features
The Java programming environment Cleaned up version of C++: no header files, macros, pointers and references, unions, structures, operator overloading, virtual base classes, templates, etc. Object-orientation:
More informationChapter 6 Introduction to Defining Classes
Introduction to Defining Classes Fundamentals of Java: AP Computer Science Essentials, 4th Edition 1 Objectives Design and implement a simple class from user requirements. Organize a program in terms of
More informationGetting Started. 1 st Week, Sun-Jeong Kim. Computer Graphics Applications
OpenGL Programming Getting Started 1 st Week, 2008 Sun-Jeong Kim Visual Studio 2005 Windows Programming 2 Visual C++ Win32 Application New Project 3 Empty project Application Settings 4 Solution Prac01
More informationAssumptions. History
Assumptions A Brief Introduction to Java for C++ Programmers: Part 1 ENGI 5895: Software Design Faculty of Engineering & Applied Science Memorial University of Newfoundland You already know C++ You understand
More informationChapter 4: Threads. Operating System Concepts 9 th Edit9on
Chapter 4: Threads Operating System Concepts 9 th Edit9on Silberschatz, Galvin and Gagne 2013 Chapter 4: Threads 1. Overview 2. Multicore Programming 3. Multithreading Models 4. Thread Libraries 5. Implicit
More informationGoals. Java - An Introduction. Java is Compiled and Interpreted. Architecture Neutral & Portable. Compiled Languages. Introduction to Java
Goals Understand the basics of Java. Introduction to Java Write simple Java Programs. 1 2 Java - An Introduction Java is Compiled and Interpreted Java - The programming language from Sun Microsystems Programmer
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 informationCHAPTER 7 OBJECTS AND CLASSES
CHAPTER 7 OBJECTS AND CLASSES OBJECTIVES After completing Objects and Classes, you will be able to: Explain the use of classes in Java for representing structured data. Distinguish between objects and
More information13 th Windsor Regional Secondary School Computer Programming Competition
SCHOOL OF COMPUTER SCIENCE 13 th Windsor Regional Secondary School Computer Programming Competition Hosted by The School of Computer Science, University of Windsor WORKSHOP I [ Overview of the Java/Eclipse
More informationGame Programming I. Introduction to Windows Programming. Sample Program hello.cpp. 5 th Week,
Game Programming I Introduction to Windows Programming 5 th Week, 2007 Sample Program hello.cpp Microsoft Visual Studio.Net File New Project Visual C++ Win32 Win32 Project Application Settings Empty project
More informationUsing DAQ Event Messaging under Windows NT/95/3.1
Application Note 086 Using DAQ Event Messaging under Windows NT/95/3.1 by Ken Sadahiro Introduction The NI-DAQ language interface for PCs is mostly a "polling-oriented" Application Programming Interface,
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 informationIntroduction to Java. Nihar Ranjan Roy. https://sites.google.com/site/niharranjanroy/
Introduction to Java https://sites.google.com/site/niharranjanroy/ 1 The Java Programming Language According to sun Microsystems java is a 1. Simple 2. Object Oriented 3. Distributed 4. Multithreaded 5.
More informationLecture 2. COMP1406/1006 (the Java course) Fall M. Jason Hinek Carleton University
Lecture 2 COMP1406/1006 (the Java course) Fall 2013 M. Jason Hinek Carleton University today s agenda a quick look back (last Thursday) assignment 0 is posted and is due this Friday at 2pm Java compiling
More informationWindows and Messages. Creating the Window
Windows and Messages In the first two chapters, the sample programs used the MessageBox function to deliver text output to the user. The MessageBox function creates a "window." In Windows, the word "window"
More informationCertified Core Java Developer VS-1036
VS-1036 1. LANGUAGE FUNDAMENTALS The Java language's programming paradigm is implementation and improvement of Object Oriented Programming (OOP) concepts. The Java language has its own rules, syntax, structure
More informationGraphical Interface and Application (I3305) Semester: 1 Academic Year: 2017/2018 Dr Antoun Yaacoub
Lebanese University Faculty of Science Computer Science BS Degree Graphical Interface and Application (I3305) Semester: 1 Academic Year: 2017/2018 Dr Antoun Yaacoub 2 Crash Course in JAVA Classes A Java
More informationOutline. Object Oriented Programming. Course goals. Staff. Course resources. Assignments. Course organization Introduction Java overview Autumn 2003
Outline Object Oriented Programming Autumn 2003 2 Course goals Software design vs hacking Abstractions vs language (syntax) Java used to illustrate concepts NOT a course about Java Prerequisites knowledge
More informationIndex. Course Outline. Grading Policy. Lab Time Distribution. Important Instructions
Index Course Outline Grading Policy Lab Time Distribution Important Instructions 2 Course Outline Week Topics 1 - History and Evolution of Java - Overview of Java 2 - Datatypes - Variables 3 - Arrays 4
More informationJAVA: A Primer. By: Amrita Rajagopal
JAVA: A Primer By: Amrita Rajagopal 1 Some facts about JAVA JAVA is an Object Oriented Programming language (OOP) Everything in Java is an object application-- a Java program that executes independently
More informationProgramming overview
Programming overview Basic Java A Java program consists of: One or more classes A class contains one or more methods A method contains program statements Each class in a separate file MyClass defined in
More informationAtelier Java - J1. Marwan Burelle. EPITA Première Année Cycle Ingénieur.
marwan.burelle@lse.epita.fr http://wiki-prog.kh405.net Plan 1 2 Plan 3 4 Plan 1 2 3 4 A Bit of History JAVA was created in 1991 by James Gosling of SUN. The first public implementation (v1.0) in 1995.
More informationLecture Notes CPSC 224 (Spring 2012) Today... Java basics. S. Bowers 1 of 8
Today... Java basics S. Bowers 1 of 8 Java main method (cont.) In Java, main looks like this: public class HelloWorld { public static void main(string[] args) { System.out.println("Hello World!"); Q: How
More informationCHAPTER 7 OBJECTS AND CLASSES
CHAPTER 7 OBJECTS AND CLASSES OBJECTIVES After completing Objects and Classes, you will be able to: Explain the use of classes in Java for representing structured data. Distinguish between objects and
More informationLecture 2, September 4
Lecture 2, September 4 Intro to C/C++ Instructor: Prashant Shenoy, TA: Shashi Singh 1 Introduction C++ is an object-oriented language and is one of the most frequently used languages for development due
More informationAn Introduction to Windows Programming Using VC++ Computer Graphics. Binghamton University. EngiNet. Thomas J. Watson
Binghamton University EngiNet State University of New York EngiNet Thomas J. Watson School of Engineering and Applied Science WARNING All rights reserved. No Part of this video lecture series may be reproduced
More informationOutline. Overview. Control statements. Classes and methods. history and advantage how to: program, compile and execute 8 data types 3 types of errors
Outline Overview history and advantage how to: program, compile and execute 8 data types 3 types of errors Control statements Selection and repetition statements Classes and methods methods... 2 Oak A
More informationCS 251 Intermediate Programming Methods and Classes
CS 251 Intermediate Programming Methods and Classes Brooke Chenoweth University of New Mexico Fall 2018 Methods An operation that can be performed on an object Has return type and parameters Method with
More informationCS 251 Intermediate Programming Methods and More
CS 251 Intermediate Programming Methods and More Brooke Chenoweth University of New Mexico Spring 2018 Methods An operation that can be performed on an object Has return type and parameters Method with
More informationDifferent Ways of Writing Windows Programs
How Windows Works Notes for CS130 Dr. Beeson Event-Driven Programming. In Windows, and also in Java applets and Mac programs, the program responds to user-initiated events: mouse clicks and key presses.
More informationKickstart Intro to Java Part I
Kickstart Intro to Java Part I COMP346/5461 - Operating Systems Revision 1.6 February 9, 2004 1 Topics Me, Myself, and I Why Java 1.2.*? Setting Up the Environment Buzz about Java Java vs. C++ Basic Java
More informationProgramming Language Concepts: Lecture 1
Programming Language Concepts: Lecture 1 Madhavan Mukund Chennai Mathematical Institute madhavan@cmi.ac.in http://www.cmi.ac.in/~madhavan/courses/pl2009 PLC 2009, Lecture 1, 12 January 2009 Data and datatypes
More informationLearning objectives. The Java Environment. Java timeline (cont d) Java timeline. Understand the basic features of Java
Learning objectives The Java Environment Understand the basic features of Java What are portability and robustness? Understand the concepts of bytecode and interpreter What is the JVM? Learn few coding
More informationCS 11 java track: lecture 1
CS 11 java track: lecture 1 Administrivia need a CS cluster account http://www.cs.caltech.edu/ cgi-bin/sysadmin/account_request.cgi need to know UNIX www.its.caltech.edu/its/facilities/labsclusters/ unix/unixtutorial.shtml
More informationInitializers: Array initializers can be used with class base types as well. The elements of the initializer can be expressions (not just constants).
CMSC 131: Chapter 15 (Supplement) Arrays II Arrays of Objects Array of Objects: The base type of an array can be a class object. Example: Array of Strings. String[ ] greatcities = new String[5]; greatcities[2]
More informationWindows Programming in C++
Windows Programming in C++ You must use special libraries (aka APIs application programming interfaces) to make something other than a text-based program. The C++ choices are: The original Windows SDK
More informationOPERATING SYSTEM. Chapter 4: Threads
OPERATING SYSTEM Chapter 4: Threads Chapter 4: Threads Overview Multicore Programming Multithreading Models Thread Libraries Implicit Threading Threading Issues Operating System Examples Objectives To
More informationMOBILE COMPUTING Practical 1: Graphic representation
MOBILE COMPUTING Practical 1: Graphic representation Steps 2) Then in class view select the Global, in global select the WINMAIN. 3) Then write the below code below #define MAX_LOADSTRING 100 enum Shapes
More informationObject Oriented Modeling
Object Oriented Modeling Object oriented modeling is a method that models the characteristics of real or abstract objects from application domain using classes and objects. Objects Software objects are
More informationGetting started with Java
Getting started with Java by Vlad Costel Ungureanu for Learn Stuff Programming Languages A programming language is a formal constructed language designed to communicate instructions to a machine, particularly
More informationCrash Course in Java. Why Java? Java notes for C++ programmers. Network Programming in Java is very different than in C/C++
Crash Course in Java Netprog: Java Intro 1 Why Java? Network Programming in Java is very different than in C/C++ much more language support error handling no pointers! (garbage collection) Threads are
More informationIntroduction to Java. Lecture 1 COP 3252 Summer May 16, 2017
Introduction to Java Lecture 1 COP 3252 Summer 2017 May 16, 2017 The Java Language Java is a programming language that evolved from C++ Both are object-oriented They both have much of the same syntax Began
More informationJava Bytecode (binary file)
Java is Compiled Unlike Python, which is an interpreted langauge, Java code is compiled. In Java, a compiler reads in a Java source file (the code that we write), and it translates that code into bytecode.
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 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 informationLecture 1: Object Oriented Programming. Muhammad Hafeez Javed
Lecture 1: Object Oriented Programming Muhammad Hafeez Javed www.rmhjaved.com Procedural vs. Object-Oriented Programming The unit in procedural programming is function, and unit in object-oriented programming
More informationChapter 4: Threads. Chapter 4: Threads
Chapter 4: Threads Silberschatz, Galvin and Gagne 2013 Chapter 4: Threads Overview Multicore Programming Multithreading Models Thread Libraries Implicit Threading Threading Issues Operating System Examples
More informationClass Information ANNOUCEMENTS
Class Information ANNOUCEMENTS Third homework due TODAY at 11:59pm. Extension? First project has been posted, due Monday October 23, 11:59pm. Midterm exam: Friday, October 27, in class. Don t forget to
More informationOperating Systems CMPSCI 377, Lec 2 Intro to C/C++ Prashant Shenoy University of Massachusetts Amherst
Operating Systems CMPSCI 377, Lec 2 Intro to C/C++ Prashant Shenoy University of Massachusetts Amherst Department of Computer Science Why C? Low-level Direct access to memory WYSIWYG (more or less) Effectively
More informationCS410 Visual Programming Solved Online Quiz No. 01, 02, 03 and 04. For Final Term Exam Preparation by Virtualians Social Network
CS410 Visual Programming Solved Online Quiz No. 01, 02, 03 and 04 For Final Term Exam Preparation by Virtualians Social Network 1. Ptr -> age is equivalent to *ptr.age ptr.age (ptr).age (*ptr).age 2. is
More informationChapter 11 Introduction to Programming in C
C: A High-Level Language Chapter 11 Introduction to Programming in C Original slides from Gregory Byrd, North Carolina State University Modified slides by Chris Wilcox, Colorado State University! Gives
More informationWA1278 Introduction to Java Using Eclipse
Lincoln Land Community College Capital City Training Center 130 West Mason Springfield, IL 62702 217-782-7436 www.llcc.edu/cctc WA1278 Introduction to Java Using Eclipse This course introduces the Java
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 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 informationModern GUI applications may be composed from a number of different software components.
Chapter 3 GUI application architecture Modern GUI applications may be composed from a number of different software components. For example, a GUI application may access remote databases, or other machines,
More informationClass, Variable, Constructor, Object, Method Questions
Class, Variable, Constructor, Object, Method Questions http://www.wideskills.com/java-interview-questions/java-classes-andobjects-interview-questions https://www.careerride.com/java-objects-classes-methods.aspx
More informationGames Course, summer Introduction to Java. Frédéric Haziza
Games Course, summer 2005 Introduction to Java Frédéric Haziza (daz@it.uu.se) Summer 2005 1 Outline Where to get Java Compilation Notions of Type First Program Java Syntax Scope Class example Classpath
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 informationJava. Classes 3/3/2014. Summary: Chapters 1 to 10. Java (2)
Summary: Chapters 1 to 10 Sharma Chakravarthy Information Technology Laboratory (IT Lab) Computer Science and Engineering Department The University of Texas at Arlington, Arlington, TX 76019 Email: sharma@cse.uta.edu
More informationIntroduction to Java Programming
Introduction to Java Programming Lecture 1 CGS 3416 Spring 2017 1/9/2017 Main Components of a computer CPU - Central Processing Unit: The brain of the computer ISA - Instruction Set Architecture: the specific
More informationVariables and Java vs C++
Variables and Java vs C++ 1 What can be improved? (variables) public void godirection(string directionname) { boolean wenttoroom = false; for (Direction direction : currentroom.getdirections()) { if (direction.getdirectionname().equalsignorecase(directionname))
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 informationG52PGP. Lecture oo3 Java (A real object oriented language)
G52PGP Lecture oo3 Java (A real object oriented language) 1 Last lecture Associating functions with data into objects is an alternative way to decompose a program Can then consider each object on its own
More informationWeiss Chapter 1 terminology (parenthesized numbers are page numbers)
Weiss Chapter 1 terminology (parenthesized numbers are page numbers) assignment operators In Java, used to alter the value of a variable. These operators include =, +=, -=, *=, and /=. (9) autoincrement
More informationChapter 2: Java OOP I
Chapter 2: Java OOP I Yang Wang wyang AT njnet.edu.cn Outline OO Concepts Class and Objects Package Field Method Construct and Initialization Access Control OO Concepts Object Oriented Methods Object An
More informationC10: Garbage Collection and Constructors
CISC 3120 C10: Garbage Collection and Constructors Hui Chen Department of Computer & Information Science CUNY Brooklyn College 3/5/2018 CUNY Brooklyn College 1 Outline Recap OOP in Java: composition &
More informationUnder the Hood: The Java Virtual Machine. Lecture 23 CS2110 Fall 2008
Under the Hood: The Java Virtual Machine Lecture 23 CS2110 Fall 2008 Compiling for Different Platforms Program written in some high-level language (C, Fortran, ML,...) Compiled to intermediate form Optimized
More informationJava Professional Certificate Day 1- Bridge Session
Java Professional Certificate Day 1- Bridge Session 1 Java - An Introduction Basic Features and Concepts Java - The new programming language from Sun Microsystems Java -Allows anyone to publish a web page
More informationAgenda CS121/IS223. Reminder. Object Declaration, Creation, Assignment. What is Going On? Variables in Java
CS121/IS223 Object Reference Variables Dr Olly Gotel ogotel@pace.edu http://csis.pace.edu/~ogotel Having problems? -- Come see me or call me in my office hours -- Use the CSIS programming tutors Agenda
More informationJava How to Program, 10/e. Copyright by Pearson Education, Inc. All Rights Reserved.
Java How to Program, 10/e Education, Inc. All Rights Reserved. Each class you create becomes a new type that can be used to declare variables and create objects. You can declare new classes as needed;
More informationCSE 421 Course Overview and Introduction to Java
CSE 421 Course Overview and Introduction to Java Computer Science and Engineering College of Engineering The Ohio State University Lecture 1 Learning Objectives Knowledgeable in how sound software engineering
More informationChapter 4: Threads. Operating System Concepts 9 th Edition
Chapter 4: Threads Silberschatz, Galvin and Gagne 2013 Chapter 4: Threads Overview Multicore Programming Multithreading Models Thread Libraries Implicit Threading Threading Issues Operating System Examples
More informationClasses, subclasses, subtyping
1 CSCE 314: Programming Languages Dr. Flemming Andersen Classes, subclasses, subtyping 2 3 Let me try to explain to you, what to my taste is characteristic for all intelligent thinking. It is, that one
More informationAgenda Process Concept Process Scheduling Operations on Processes Interprocess Communication 3.2
Lecture 3: Processes Agenda Process Concept Process Scheduling Operations on Processes Interprocess Communication 3.2 Process in General 3.3 Process Concept Process is an active program in execution; process
More informationAgenda. CSE P 501 Compilers. Java Implementation Overview. JVM Architecture. JVM Runtime Data Areas (1) JVM Data Types. CSE P 501 Su04 T-1
Agenda CSE P 501 Compilers Java Implementation JVMs, JITs &c Hal Perkins Summer 2004 Java virtual machine architecture.class files Class loading Execution engines Interpreters & JITs various strategies
More informationLecture 6 Introduction to Objects and Classes
Lecture 6 Introduction to Objects and Classes Outline Basic concepts Recap Computer programs Programming languages Programming paradigms Object oriented paradigm-objects and classes in Java Constructors
More informationCSE P 501 Compilers. Java Implementation JVMs, JITs &c Hal Perkins Winter /11/ Hal Perkins & UW CSE V-1
CSE P 501 Compilers Java Implementation JVMs, JITs &c Hal Perkins Winter 2008 3/11/2008 2002-08 Hal Perkins & UW CSE V-1 Agenda Java virtual machine architecture.class files Class loading Execution engines
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 informationPaytm Programming Sample paper: 1) A copy constructor is called. a. when an object is returned by value
Paytm Programming Sample paper: 1) A copy constructor is called a. when an object is returned by value b. when an object is passed by value as an argument c. when compiler generates a temporary object
More informationFinal CSE 131B Spring 2004
Login name Signature Name Student ID Final CSE 131B Spring 2004 Page 1 Page 2 Page 3 Page 4 Page 5 Page 6 Page 7 Page 8 (25 points) (24 points) (32 points) (24 points) (28 points) (26 points) (22 points)
More informationCE221 Programming in C++ Part 1 Introduction
CE221 Programming in C++ Part 1 Introduction 06/10/2017 CE221 Part 1 1 Module Schedule There are two lectures (Monday 13.00-13.50 and Tuesday 11.00-11.50) each week in the autumn term, and a 2-hour lab
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