Your First Java Application

Slides:



Advertisements
Similar presentations
Introduction To Java Objectives For Today â Introduction To Java â The Java Platform & The (JVM) Java Virtual Machine â Core Java (API) Application Programming.
Advertisements

Lab Information Security Using Java (Review) Lab#0 Omaima Al-Matrafi.
MC697 Object-Oriented Programming Using Java. In this class, we will cover: How the class will be structured Difference between object-oriented programming.
Lab#1 (14/3/1431h) Introduction To java programming cs425
Client Side Programming Using Java Applet Outcomes: You will be expected to know: – Java Applets and HTML file; –bytecode and platform independent programs;
Object Orientated Programming
Lecture 2: Do you speak Java?. From Problem to Program Last Lecture we looked at modeling with objects! Steps to solving a business problem –Investigate.
Objects and Classes First Programming Concepts. 14/10/2004Lecture 1a: Introduction 2 Fundamental Concepts object class method parameter data type.
Lecture 2: Do you speak Java?. From Problem to Program Last Lecture we looked at modeling with objects! Steps to solving a business problem –Investigate.
Introduction to Java.
9-Aug-15 Vocabulary. Programming Vocabulary Watch closely, you might even want to take some notes. There’s a short quiz at the end of this presentation!
CSE 1301 J Lecture 2 Intro to Java Programming Richard Gesick.
Getting Started with Java
Introduction to Java Tonga Institute of Higher Education.
Introducing Java.
Java Programming, 2E Introductory Concepts and Techniques Chapter 2 Creating a Java Application and Applet.
+ Java vs. Javascript Jessi Style. + Java Compiled Can stand on its own Written once, run anywhere Two-stage debugging Java is an Object Oriented Programming.
Parts of a Computer Why Use Binary Numbers? Source Code - Assembly - Machine Code.
Introduction to Java Appendix A. Appendix A: Introduction to Java2 Chapter Objectives To understand the essentials of object-oriented programming in Java.
Programming Languages and Paradigms Object-Oriented Programming.
Chapter 1: Creating Java Programs
111 © 2002, Cisco Systems, Inc. All rights reserved.
Chapter 1 Introduction. Goal to learn about computers and programming to compile and run your first Java program to recognize compile-time and run-time.
Chapter 34 Java Technology for Active Web Documents methods used to provide continuous Web updates to browser – Server push – Active documents.
1 Module Objective & Outline Module Objective: After completing this Module, you will be able to, appreciate java as a programming language, write java.
An Introduction to Java Chapter 11 Object-Oriented Application Development: Part I.
Chapter 1: Introducing JAVA. 2 Introduction Why JAVA Applets and Server Side Programming Very rich GUI libraries Portability (machine independence) A.
Object Oriented Programming Examples: C++, Java Advantages: 1. reusibility of code 2. ability to adapt (extend) previously written code.
Jaeki Song ISQS6337 JAVA Lecture 03 Introduction to Java -The First Java Application-
© 2012 Pearson Education, Inc. All rights reserved. 1-1 Why Java? Needed program portability – Program written in a language that would run on various.
Your First Java Application Chapter 2. 2 Program Concepts Modern object-oriented programs help us build models to manage the complexity found in a problem.
Java Programming, Second Edition Chapter One Creating Your First Java Program.
Java Programming Presented by Daniel Rosenthal Friday, November 30 th, 2007.
Compiling and the Java Virtual Machine (JVM). The syntax of Pseudocode is pretty loose –visual validation encourages a permissive approach –emphasized.
About the Presentations The presentations cover the objectives found in the opening of each chapter. All chapter objectives are listed in the beginning.
Lecture 8 February 29, Topics Questions about Exercise 4, due Thursday? Object Based Programming (Chapter 8) –Basic Principles –Methods –Fields.
4-Nov-15 Air Force Institute of Technology Electrical and Computer Engineering Object-Oriented Programming Design Topic 1: The Java Environment Maj Joel.
23-October-2002cse JavaIntro © 2002 University of Washington1 Intro to Java CSE 413, Autumn 2002 Programming Languages
Chapter 6 Introduction to Defining Classes. Objectives: Design and implement a simple class from user requirements. Organize a program in terms of a view.
11/28/2015B.Ramamurthy1 Object-Oriented Design and Java B.Ramamurthy.
Overview Object oriented programming How to run a simple program.
© 2012 Pearson Education, Inc. All rights reserved types of Java programs Application – Stand-alone program (run without a web browser) – Relaxed.
Today… “Hello World” ritual. Brief History of Java & How Java Works. Introduction to Java class structure. But first, next slide shows Java is No. 1 programming.
Creating a Java Application and Applet
©2016 Pearson Education, Inc. Upper Saddle River, NJ. All Rights Reserved. CSC 110 – INTRO TO COMPUTING - PROGRAMMING Overview of Programming.
28-June-2002cse142-C2-Classes © 2002 University of Washington1 Classes CSE 142, Summer 2002 Computer Programming 1
Spring 2009 Programming Fundamentals I Java Programming XuanTung Hoang Lecture No. 8.
CSCI 212 Object-Oriented Programming in Java. Prerequisite: CSCI 111 variable assignment statement while loop for loop post-increment (i++) strong typing.
Review A program is… a set of instructions that tell a computer what to do. Programs can also be called… software. Hardware refers to… the physical components.
Java Programming Fifth Edition Chapter 1 Creating Your First Java Classes.
SESSION 1 Introduction in Java. Objectives Introduce classes and objects Starting with Java Introduce JDK Writing a simple Java program Using comments.
 It is a pure oops language and a high level language.  It was developed at sun microsystems by James Gosling.
Introduction to Algorithm. What is Algorithm? an algorithm is any well-defined computational procedure that takes some value, or set of values, as input.
Lecture 1b- Introduction
Before You Begin Nahla Abuel-ola /WIT.
Object-Oriented Programming Using Java
SSD1 – Introduction to Information Systems
Topic: Difference b/w JDK, JRE, JIT, JVM
Java Primer 1: Types, Classes and Operators
C# and the .NET Framework
1. Environment Setting Minhaeng Lee.
Java programming lecture one
Introduction to Java Dept. Business Computing University of Winnipeg
Fundamentals of Programming
Problem Solving, Object-Oriented Design and Java
Problem Solving, Object-Oriented Design and Java
Chap 1. Getting Started Objectives
Chap 4. Programming Fundamentals
Review of Previous Lesson
Presentation transcript:

Your First Java Application Chapter 2 Your First Java Application

Objectives understand how computer programs model the world understand the difference between a class and an object define fields and state explain what methods are understand how objects create relationships define the terms association, composition and specialization …continued

Objectives explain the difference between syntax and semantics write, compile and run a Java applet with an HTML container write, compile and run a Java application using a dialog box*

Installing Java follow the instructions on the projection screen install Java Development Kit (JDK) from the Sun website Install Java Runtime Environment (JRE)

Program Concepts Modern object-oriented programs help us build models to manage the complexity found in a problem domain. The “problem domain” describes real-world objects and concepts that a computer program is trying to solve.

Models A model is a simplification of a complex system. A good model: Helps to identify the most important aspects of a problem. Helps a programmer to focus on the problem he or she is trying to solve instead of on the complexity of the problem’s data.

What is a metaphor? A metaphor is a word or phrase used in place of another word or phrase to denote a likeness. Computer programs use “metaphors” to represent real objects.

Objects Objects represent real-world things: Objects have: Ship Rudder Wheel Instruments Objects have: properties (characteristics) methods (behaviors)*

Classes and Objects A class is a definition of a type: Like a template, a class defines the characteristics and behaviors of the type. An object is an instance of a class: Can be instantiated and manipulated An object’s characteristics are defined by the class that was used to create the object. (continued…)

Classes and Objects an object is an “instance” of a class the dog Bowser is an instance of the class dog the act of creating an object is called “instantiation”

Fields Fields define the properties of a class. Can be intrinsic or built-in “types” (int, boolean…) Can be user-defined objects fields, instance variables and properties are interchangeable State is the current value of a field in an object.*

Methods Methods describe the capabilities of the class. The capabilities are implemented by a method. example: a Dog can bark( ), a spaceship can fire( ) Every method must be called from another method. The only exception is main(), which is called by the OS. Methods can accept parameters. Parameters are enclosed in the parentheses*

Object Relationships Association Composition A method of one object calls the method of another object. Composition Some objects are composed of other objects.*

Specialization Hierarchies of classes move from a generalized class to a more specific class.

Topic Check Complete Questions 1 – 3, p. 43*

Creating Programs Syntax and Semantics A language’s exact keywords, punctuation, and order of terms are called its syntax. Semantics refers to the meaning of one’s instructions; what the program is trying to accomplish.*

Writing a Java Program Writing a Java program requires five steps: Analyze Design Write Compile Test*

Compiling the Code Programs must be compiled in order for the CPU to understand and execute the instructions. Java byte code is run through the Java Virtual Machine (JVM), which translates the code for the CPU. .java files are compiled by the javac (java compiler) program into .class files.*

Types of Java Programs Applet Application Requires an .HTML file with the <applet> tag to reference the .class file Can also be run using the appletviewer.exe program file Application Run by the java.exe program file Run without a browser interface, often using the console window*

HelloWorld.java Analysis The keyword import allows existing class libraries to be reused. The keyword public signifies that a class is visible to other classes. Braces {} indicate the beginning and end of a block of code. Braces must always be “balanced” Align opening and closing braces*

More HelloWorld.java Analysis The keyword void signifies that a method does not return a value. Identifiers are the names given to classes, fields, and methods. Identifiers are case sensitive. Identifiers often use camel case notation.*