AP Computer Science A – Healdsburg High School 1 Unit 2 - Structure of a Java Program - Documentation - Types of Errors - Example.

Slides:



Advertisements
Similar presentations
Designing a Program & the Java Programming Language
Advertisements

IT151: Introduction to Programming
JAVA BASICS SYNTAX, ERRORS, AND DEBUGGING. GCOC – A.P. Computer Science A College Board Computer Science A Topics Covered Program Design - Read and understand.
Your First Java Program: HelloWorld.java
Chapter 1: Introduction
Slides prepared by Rose Williams, Binghamton University Chapter 1 Getting Started 1.1 Introduction to Java.
How to Create a Java program CS115 Fall George Koutsogiannakis.
Aalborg Media Lab 21-Jun-15 Software Design Lecture 1 “ Introduction to Java and OOP”
Java Intro. A First Java Program //The Hello, World! program in Java public class Hello { public static void main(String[] args) { System.out.println("Hello,
01 Introduction1June Introduction CE : Fundamental Programming Techniques.
Slide 1 of 40. Lecture A The Java Programming Language Invented 1995 by James Gosling at Sun Microsystems. Based on previous languages: C, C++, Objective-C,
C# Programming: From Problem Analysis to Program Design1 2 Your First C# Program.
1. 2 Chapter 1 Introduction to Computers, Programs, and Java.
“Introduction to Programming With Java”
Intro to Java Programming  A computer follows the instruction precisely and exactly.  Anything has to be declared and defined before it can be used.
Basics Programming Concepts. Basics A computer program is a set of instructions to tell a computer what to do Machine language = circuit level language.
1 Classes begin with capital letters (i.e. UrRobot). Methods, objects, and variable names begin with lower case (camelCase) Use indentation to line up.
Chapter 3: Completing the Problem- Solving Process and Getting Started with C++ Introduction to Programming with C++ Fourth Edition.
Introduction to Java Thanks to Dan Lunney (SHS). Java Basics File names The “main” method Output to screen Escape Sequence – Special Characters format()
JAVA BASICS: Variables and References SYNTAX, ERRORS, AND DEBUGGING.
Board Activity Find your seat on the seating chart Login – Remember your login is your first initial your last name and the last three numbers of your.
How to Run a Java Program CSE 1310 – Introduction to Computers and Programming Vassilis Athitsos University of Texas at Arlington 1.
An Introduction to Software Development Java Methods A & AB Object-Oriented Programming and Data Structures Maria Litvin ● Gary Litvin Copyright © 2006.
2-1 Hardware CPU Memory - 2 kinds Network Graphics Input and Output Devices.
About the Presentations The presentations cover the objectives found in the opening of each chapter. All chapter objectives are listed in the beginning.
3 Major Steps for Creating/Running a Java Program You write the source code for the program and save it as a.java file. You compile the.java program using.
CHAPTER 3 GC Java Fundamentals. 2 BASICS OF JAVA ENVIRONMENT  The environment  The language  Java applications programming Interface API  Various.
BUILDING JAVA PROGRAMS CHAPTER 2 Days of For Loops Past.
Comments in Java. When you create a New Project in NetBeans, you'll notice that some text is greyed out, with lots of slashes and asterisks:
FIRST JAVA PROGRAM. JAVA PROGRAMS Every program may consist of 1 or more classes. Syntax of a class: Each class can contain 1 or more methods. public.
BUILDING JAVA PROGRAMS CHAPTER 1 ERRORS. 22 OBJECTIVES Recognize different errors that Java uses and how to fix them.
Building java programs chapter 6
CSci 111 – computer Science I Fall 2014 Cynthia Zickos WRITING A SIMPLE PROGRAM IN JAVA.
1 BUILDING JAVA PROGRAMS CHAPTER 2 Pseudocode and Scope.
JAVA Practical Creating our first program 2. Source code file 3. Class file 4. Understanding the different parts of our program 5. Escape characters.
ECE 122 Feb. 1, Introduction to Eclipse Java Statements Declaration Assignment Method calls.
ERRORS. Types of errors: Syntax errors Logical errors.
Java FilesOops - Mistake Java lingoSyntax
AP Computer Science A – Healdsburg High School 1 Unit 2 - Object-Oriented Programming - Example.
AP Computer Science A – Healdsburg High School 1 Unit 9 - Parameter Passing in Java.
Jeopardy $100 VariablesErrorsLoops Classes and Objects Program Structure $200 $300 $400 $500 $400 $300 $200 $100 $500 $400 $300 $200 $100 $500 $400 $300.
Computer Science A 1. Course plan Introduction to programming Basic concepts of typical programming languages. Tools: compiler, editor, integrated editor,
Programming 2 Intro to Java Machine code Assembly languages Fortran Basic Pascal Scheme CC++ Java LISP Smalltalk Smalltalk-80.
Java Programming Fifth Edition Chapter 1 Creating Your First Java Classes.
Introduction to 1. What is Java ? Sun Microsystems Java is a programming language and computing platform first released by Sun Microsystems in The.
Intro to Programming STARS College of Communication and Information Florida State University Written by: Hannah Brock Alissa Ovalle Nicolaus Lopez Martin.
Introduction to programming in java
Computer Programming Your First Java Program: HelloWorld.java.
The eclipse IDE IDE = “Integrated Development Environment”
Object-Oriented Programming Using Java
Chapter 3 GC 101 Java Fundamentals.
Introduction to.
Syntax & Semantics UML - Java
Eclipse Navigation & Usage.
Java programming lecture one
Lecture Note Set 1 Thursday 12-May-05
Writing Methods.
String Output ICS 111: Introduction to Computer Science I
Social Media And Global Computing Introduction to Visual Studio
Hands-on Introduction to JAVA
Exercise 11.1 Write a code fragment that performs the same function as the statement below without using the crash method Toolbox.crash(amount < 0,
Introduction CSC 111.
Data Types, Concatenation, PEMDAS, Shortcuts, and Comments
Java Intro.
CS110D Programming Language I
Errors in programming.
Developing Java Applications with NetBeans
Developing Java Applications with NetBeans
How to Run a Java Program
Presentation transcript:

AP Computer Science A – Healdsburg High School 1 Unit 2 - Structure of a Java Program - Documentation - Types of Errors - Example

AP Computer Science A – Healdsburg High School 2 Java’s Compiler + Interpreter Editor     MyFirstProgram.java Compiler   MyFirstProgram.class Interpreter  This is you… Interpreter

AP Computer Science A – Healdsburg High School Structure of a Java Program For Unit 2, you will be writing the most basic form of Java Programs. They look like this: public class SomeName { public static void main (String [ ] args) { statement; … } This name must match the filename. This is where the program starts. It looks for the “main method” and begins here.

AP Computer Science A – Healdsburg High School Documentation (called “comments” in Computer Science) // Name: // Last Changed: // Description: What does this program do. public class SomeName { public static void main (String [ ] args) { statement; … } At the top of each file, I would like you have the following documentation

AP Computer Science A – Healdsburg High School Types of Errors Syntax Error: an error that the compiler gives you. This could be a missing “;” misspelled word, missing (), etc Logic Error: an error that causes the program to not work correctly. A.K.A. “Software Bugs” Example: If the program required you to draw an octagon and you drew a hexagon.

AP Computer Science A – Healdsburg High School 6 The First “Bug” “(moth) in relay”

AP Computer Science A – Healdsburg High School Output to the console screen in Java (the little black screen) Examples String firstName = “Mike”; String lastName = “Efram”; System.out.println(firstName); System.out.println(lastName); System.out.print(firstName); System.out.print(lastName); System.out.println(firstName + “ ” + lastName); Two output methods: 1)System.out.println(someString); 2)System.out.print(someString);