Presentation is loading. Please wait.

Presentation is loading. Please wait.

Introduction to Java Chapter 1 - Introduction to Java1 Chapter 1 Introduction to Java.

Similar presentations


Presentation on theme: "Introduction to Java Chapter 1 - Introduction to Java1 Chapter 1 Introduction to Java."— Presentation transcript:

1 Introduction to Java Chapter 1 - Introduction to Java1 Chapter 1 Introduction to Java

2 Chapter 1 - Introduction to Java2 Introduction to Java Java is an object-oriented language It is platform-independent; a program will run unchanged on a PC, Mac, or Unix workstation Device-independent graphics are built directly into the language

3 Introduction to Java Chapter 1 - Introduction to Java3 Principal Elements of Java The Java programming language itself The Java Virtual Machine (JVM) –A “virtual computer” that executes Java code identically, regardless of host computer type –There must be a custom JVM for each type of computer executing Java programs The Java Application Programming Interface (API) –Defines the standard classes built into the language

4 Introduction to Java Chapter 1 - Introduction to Java4 Objects An object is a software component that incorpo- rates data and behaviors, which are actions that can be performed with the data –Data are stored in instance variables, which are hidden from the outside world –The behaviors are implemented by methods –Methods protect the data from direct modification by the outside world

5 Introduction to Java Chapter 1 - Introduction to Java5 Objects (2) Objects contain a nucleus of data surrounded and protected by methods These methods form an interface between the data and the outside world Objects communicate by calling each other’s methods

6 Introduction to Java Chapter 1 - Introduction to Java6 Communications Objects communicate by calling each other’s methods Each call has three components: –The name of the object being called followed by a period –The name of the method to execute –Any parameters needed by the method

7 Introduction to Java Chapter 1 - Introduction to Java7 Classes Classes are the software blueprints from which objects are made A class definition specifies the number and type of instance variables to include in an object, and the methods that implement the behavior of the object Many objects can be instantiated from a single class definition

8 Introduction to Java Chapter 1 - Introduction to Java8 Instantiating Objects Many objects can be instan- tiated from a single class Each object has its own copy of the instance variables defined in the class All objects from the class share the same method definitions

9 Introduction to Java Chapter 1 - Introduction to Java9 A First Java Program Class Definition Method Definition Comments Comment


Download ppt "Introduction to Java Chapter 1 - Introduction to Java1 Chapter 1 Introduction to Java."

Similar presentations


Ads by Google