Download presentation
Presentation is loading. Please wait.
Published byLisa Knight Modified over 9 years ago
2
CS 178: Programming with Multimedia Objects Aditya P. Mathur Professor of Computer Sciences Purdue University, West Lafayette August 27, 2004 Last update: August 30, 2004 Classes, Objects, Applets
3
Course Introduction Aditya P. Mathur 2004 2 Learning Objectives What is an object? What is a class? Class hierarchy Simple example (Applet)
4
Course Introduction Aditya P. Mathur 2004 3 Class A collection of data and methods. Data: Example: class Dog dogName dog Breed dogOwner dogVet
5
Course Introduction Aditya P. Mathur 2004 4 High Level-Low Level Languages A CPU|GPU|SPU in a computer understands instructions coded as only 1’s and 0’s. The language of 0’s and 1’s is a low level language known as machine language. Java allows the coding of instructions using keywords from English, e.g. applet, class, and String. Java is a high-level language. How does a CPU/GPU/SPU understand instructions coded in Java?
6
Course Introduction Aditya P. Mathur 2004 5 Language Translation Java Program Java Compiler Byte Code Java Virtual machine (JVM) Instructions executed by the CPU Output JVM interprets Java byte code instructions. JVM instructions are executed by the CPU. Different from machine (CPU) code
7
Course Introduction Aditya P. Mathur 2004 6 Platform Independence Byte Code Java Virtual machine Java Virtual machine Java Virtual machine WindowsUnixOS X Others
8
Course Introduction Aditya P. Mathur 2004 7 Structure of a Java Program Java Program Class....... One or more classes Method Each class contains data and methods. Data Method Data Method Data Instructions
9
Course Introduction Aditya P. Mathur 2004 8 A Sample Java Applet Let us examine an interesting Java applet!
10
Course Introduction Aditya P. Mathur 2004 9 Do you know what these mean? literal identifier method parameters class object type integer (int) void arguments Button new Graphics init paint setColor event ActionListener actionPerformed start
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.