Introducing Java Chapter 3 Review. Why Program in Java? Java, is an object-oriented programming language. OOP languages evolved out of the need to better.

Slides:



Advertisements
Similar presentations
CS0007: Introduction to Computer Programming Console Output, Variables, Literals, and Introduction to Type.
Advertisements

IT151: Introduction to Programming
Objectives You should be able to describe: Introduction to Programming
JAVA BASICS SYNTAX, ERRORS, AND DEBUGGING. OBJECTIVES FOR THIS UNIT Upon completion of this unit, you should be able to: Explain the Java virtual machine.
JAVA BASICS SYNTAX, ERRORS, AND DEBUGGING. GCOC – A.P. Computer Science A College Board Computer Science A Topics Covered Program Design - Read and understand.
MC697 Object-Oriented Programming Using Java. In this class, we will cover: How the class will be structured Difference between object-oriented programming.
© 2007 Lawrenceville Press Slide 1 Chapter 3 Classes and Objects.
 2005 Pearson Education, Inc. All rights reserved Introduction.
Your First Java Program: HelloWorld.java
 C++ programming facilitates a disciplined approach to program design. ◦ If you learn the correct way, you will be spared a lot of work and frustration.
Chapter 1: Introduction
1 Key Concepts:  Why C?  Life Cycle Of a C program,  What is a computer program?  A program statement?  Basic parts of a C program,  Printf() function?
 2003 Prentice Hall, Inc. All rights reserved. Customized by Sana Odeh for the use of this class. 1 Introduction to Computers and Programming in JAVA.
1. 2 Chapter 1 Introduction to Computers, Programs, and Java.
By: Mr. Baha Hanene Chapter 3. Learning Outcomes We will cover the learning outcome 02 in this chapter i.e. Use basic data-types and input / output in.
Computer Programming-1 CSC 111 Chapter 1 : Introduction.
Introducing Java.
© The McGraw-Hill Companies, 2006 Chapter 1 The first step.
Java Applications & Program Design
Introduction to Java Appendix A. Appendix A: Introduction to Java2 Chapter Objectives To understand the essentials of object-oriented programming in Java.
Chapter 8 High-Level Programming Languages (modified by Erin Chambers)
Chapter 1: Creating Java Programs
Android How to Program, 2/e © Copyright by Pearson Education, Inc. All Rights Reserved.
IPC144 Introduction to Programming Using C Week 1 – Lesson 2
Introduction to Java Thanks to Dan Lunney (SHS). Java Basics File names The “main” method Output to screen Escape Sequence – Special Characters format()
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 1 CSIS-120: Java Intro. What is Programming?  A: It is what makes computer so useful.  The flexibility of a computer is amazing  Write a term.
Programming With C.
Computer Programming TCP1224 Chapter 3 Completing the Problem-Solving Process and Getting Started with C++
Input, Output, and Processing
Intro and Review Welcome to Java. Introduction Java application programming Use tools from the JDK to compile and run programs. Videos at
Java Programming, Second Edition Chapter One Creating Your First Java Program.
Week 1 - Friday.  What did we talk about last time?  Our first Java program.
Chapter 8 High-Level Programming Languages. 8-2 Chapter Goals Describe the translation process and distinguish between assembly, compilation, interpretation,
CHAPTER 3 GC Java Fundamentals. 2 BASICS OF JAVA ENVIRONMENT  The environment  The language  Java applications programming Interface API  Various.
Programming Fundamentals. Today’s Lecture Why do we need Object Oriented Language C++ and C Basics of a typical C++ Environment Basic Program Construction.
COMPUTER PROGRAMMING. A Typical C++ Environment Phases of C++ Programs: 1- Edit 2- Preprocess 3- Compile 4- Link 5- Load 6- Execute Loader Primary Memory.
Copyright © 2012 Pearson Education, Inc. Chapter 2: Introduction to C++
Object-Oriented Program Development Using Java: A Class-Centered Approach, Enhanced Edition.
 Pearson Education, Inc. All rights reserved Introduction to Java Applications.
Introduction to programming in the Java programming language.
Programming for Beginners Martin Nelson Elizabeth FitzGerald Lecture 2: Variables & Data Types.
Copyright © 2012 Pearson Education, Inc. Publishing as Pearson Addison-Wesley C H A P T E R 2 Input, Processing, and Output.
Basic Program Construction
Introducing Python CS 4320, SPRING Lexical Structure Two aspects of Python syntax may be challenging to Java programmers Indenting ◦Indenting is.
JAVA Practical Creating our first program 2. Source code file 3. Class file 4. Understanding the different parts of our program 5. Escape characters.
Chapter 3 Introduction To Java. OBJECTIVES Packages & Libraries Statements Comments Bytecode, compiler, interpreter Outputting print() & println() Formatting.
Anatomy of a Java Program. AnotherQuote.java 1 /** A basic java program 2 * 3 Nancy Harris, James Madison University 4 V1 6/2010.
CSC 1010 Programming for All Lecture 3 Useful Python Elements for Designing Programs Some material based on material from Marty Stepp, Instructor, University.
© 2007 Lawrenceville Press Slide 1 Chapter 3 Classes and Objects 1. How is a class different from an object?
Objective Write simple computer program in C++ Use simple Output statements Become familiar with fundamental data types.
Chapter 3 Introducing Java. Objectives and Goals 1. Define terminology associated with object- oriented programming. 2. Explain why Java is a widely used.
Microsoft Visual Basic 2012: Reloaded Fifth Edition Chapter One An Introduction to Visual Basic 2012.
CHAPTER 3 COMPLETING THE PROBLEM- SOLVING PROCESS AND GETTING STARTED WITH C++ An Introduction to Programming with C++ Fifth Edition.
Java Programming Fifth Edition Chapter 1 Creating Your First Java Classes.
Introducing Java Chapter 3. Why Program in Java? 0 Java was developed by Sun Microsystems. It is a widely used high-level programming language. 0 One.
STRUCTURED PROGRAMMING Complete C++ Program. Content 2  Main Function  Preprocessor directives  User comments  Escape characters  cout statement.
Topics Designing a Program Input, Processing, and Output
GC101 Introduction to computer and program
Chapter 2, Part I Introduction to C Programming
Data types and variables
Introduction Java Chapter 3.
Programming Vocabulary.
Chapter 3 Classes and Objects
Chapter 1: Computer Systems
A programming language
Topics Designing a Program Input, Processing, and Output
Topics Designing a Program Input, Processing, and Output
Computer Programming-1 CSC 111
Introduction to Programming - 1
Presentation transcript:

Introducing Java Chapter 3 Review

Why Program in Java? Java, is an object-oriented programming language. OOP languages evolved out of the need to better develop complex programs. Java is also platform independent meaning it can run on any computer

Objects, Classes & Packages Object-oriented languages use classes to define objects. A class defines the type of data and actions associated with an object, but not the actual data for an object. A package groups related classes. A Java application is a package with at least one class.

A Java Application A program consists of a set of instructions called statements. A semi-colon is required to indicate the end of a statement. Related statements are enclosed by curly brackets Methods are a named set of statements that perform a single, well-defined task. Comments in an application provide details about the code to the reader.

Executing a Java Application The code typed by a programmer is called source code. It is translated to bytecode with a compiler. Program execution occurs when the bytecode is interpreted with a Java Virtual Machine (JVM). If a program contains errors, it will not compile. One type of error is the syntax error, which results when a statement violates the rules of Java.

Displaying Output The standard output stream is typically the computer screen and requires the System.out. methods print() and println(). println() puts the insertion point on the next line. These methods require a string argument. If a program contains errors, it will not compile. Escape sequences are used to display special characters. i.e.) \n new line, \t tab (8 spaces), \\ backslash

Formatting Output Output can be formatted with the format() method. A format string specifier takes the form: %[alignment][width]s % indicates the start of a specifier [alignment] skip for right alignment, Include a minus sign (–) for left alignment [width] the number of characters to use for output s indicates that the corresponding argument is a string System.out.format("%-10s %8s %8s", "Team", "Wins", "Losses\n");

Code Conventions Code conventions are a set of guidelines for writing an application. They are: An introductory comment should begin a program. This comment should include information such as your name, class name, the date, and a brief statement about the program. Package names should begin with a lowercase letter and then an uppercase letter should begin each word within the name. Package names may not contain spaces.

Code Conventions Cont’d Class names should be nouns and begin with an uppercase letter and then an uppercase letter should begin each word within the name. Class names may not contain spaces. A comment block should be included before each class and method. A comment block is not typically placed before the main() method. Comments should not reiterate what is clear from the code. Statements in a method should be indented.

Code Conventions Cont’d An open curly brace ({) should be placed on the same line as the class or method declaration, and the closing curly brace (}) should be on a separate line and aligned with the class or method declaration.

Algorithm Design An algorithm is a list of steps to solve a problem. When written in plain English, with a mixture of code it is called pseudocode. Algorithms can also be presented visually with a flowchart.

Flowchart Symbols Start or end process flow of control process Input/output

Flowchart Symbols Cont’d Conditional or decision sub routines