AP Computer Science Anthony Keen. Computer 101 What happens when you turn a computer on? –BIOS tries to start a system loader –A system loader tries to.

Slides:



Advertisements
Similar presentations
Overloading Having more than one method with the same name is known as overloading. Overloading is legal in Java as long as each version takes different.
Advertisements

Programming for Beginners Martin Nelson Elizabeth FitzGerald Lecture 3: Flow Control I: For Loops.
Chapter 8: Arrays.
Air Force Institute of Technology Electrical and Computer Engineering
Question from the last class What happens if we cast “too large” float/double to an int? int has range float a=1e10f; int b=(int)
1 pritisajja.info Unlocking the World of Java Programming….. Priti Srinivas Sajja February, 2014 Visit pritisajja.info for detail Future Technology for.
Fundamental Programming Structures in Java: Control Flow, Arrays and Vectors.
Written by: Dr. JJ Shepherd
IntroductionIntroduction  Computer program: an ordered sequence of statements whose objective is to accomplish a task.  Programming: process of planning.
CS 106 Introduction to Computer Science I 09 / 13 / 2006 Instructor: Michael Eckmann.
10-Jun-15 Just Enough Java. Variables A variable is a “box” that holds data Every variable has a name Examples: name, age, address, isMarried Variables.
Variables Pepper. Variable A variable –box –holds a certain type of value –value inside the box can change Example –A = 2B+1 –Slope = change in y / change.
IAT 800 Foundations of Computational Art and Design Lecture 2.
1 Chapter 4 Language Fundamentals. 2 Identifiers Program parts such as packages, classes, and class members have names, which are formally known as identifiers.
Java Syntax Primitive data types Operators Control statements.
Some basic I/O.
Fundamental Programming Structures in Java: Comments, Data Types, Variables, Assignments, Operators.
Introduction to Java. Main() Main method is where the program execution begins. There is only one main Displaying the results: System.out.println (“Hi.
CIS3931 – Intro to JAVA Lecture Note Set 3 19-May-05.
Hello AP Computer Science!. What are some of the things that you have used computers for?
DAT602 Database Application Development Lecture 5 JAVA Review.
General Features of Java Programming Language Variables and Data Types Operators Expressions Control Flow Statements.
By Nicholas Policelli An Introduction to Java. Basic Program Structure public class ClassName { public static void main(String[] args) { program statements.
Introduction to Programming David Goldschmidt, Ph.D. Computer Science The College of Saint Rose Java Fundamentals (Comments, Variables, etc.)
Basic Java Programming CSCI 392 Week Two. Stuff that is the same as C++ for loops and while loops for (int i=0; i
JAVA Tokens. Introduction A token is an individual element in a program. More than one token can appear in a single line separated by white spaces.
Java means Coffee Java Coffee Beans The name “JAVA” was taken from a cup of coffee.
Hello.java Program Output 1 public class Hello { 2 public static void main( String [] args ) 3 { 4 System.out.println( “Hello!" ); 5 } // end method main.
1 Advanced Programming IF. 2 Control Structures Program of control –Program performs one statement then goes to next line Sequential execution –Different.
Programming for Beginners Martin Nelson Elizabeth FitzGerald Lecture 2: Variables & Data Types.
CompSci 100E 2.1 Java Basics - Expressions  Literals  A literal is a constant value also called a self-defining term  Possibilities: o Object: null,
An Introduction to Java – Part 1 Dylan Boltz. What is Java?  An object-oriented programming language  Developed and released by Sun in 1995  Designed.
Primitive data Week 3. Lecture outcomes Primitive data – integer – double – string – char – Float – Long – boolean Declaration Initialisation Assignments.
Controlling Program Flow. Data Types and Variable Declarations Controlling Program Flow.
BEGINNING PROGRAMMING.  Literally – giving instructions to a computer so that it does what you want  Practically – using a programming language (such.
1-Dec-15 Additional control structures. 2 The if-else statement The if-else statement chooses which of two statements to execute The if-else statement.
CS 100Lecture 21 CS100J: Lecture 2 n Previous Lecture –Programming Concepts n problem, algorithm, program, computer, input, output, sequential execution,
Lecture 6: Midterm Review Tami Meredith. Programming Process How do we fill in the yellow box? Text Editor Compiler (javac) Interpreter (JVM: java) User.
1 Basic Java Constructs and Data Types – Nuts and Bolts Looking into Specific Differences and Enhancements in Java compared to C.
School of Computer Science & Information Technology G6DICP - Lecture 4 Variables, data types & decision making.
Operators in JAVA. Operator An operator is a symbol that operates on one or more arguments to produce a result. Java provides a rich set of operators.
LCC 6310 Computation as an Expressive Medium Lecture 2.
Arrays-. An array is a way to hold more than one value at a time. It's like a list of items.
Boolean expressions, part 1: Compare operators. Compare operators Compare operators compare 2 numerical values and return a Boolean (logical) value A.
BOOLEAN OPERATIONS AND CONDITIONALS CHAPTER 20 1.
2: Basics Basics Programming C# © 2003 DevelopMentor, Inc. 12/1/2003.
An Introduction to Java – Part 1 Erin Hamalainen CS 265 Sec 001 October 20, 2010.
CS 106 Introduction to Computer Science I 09 / 10 / 2007 Instructor: Michael Eckmann.
Chad’s C++ Tutorial Demo Outline. 1. What is C++? C++ is an object-oriented programming (OOP) language that is viewed by many as the best language for.
1 Lecture # 2. * Introducing Programming with an Example * Identifiers, Variables, and Constants * Primitive Data Types * Byte, short, int, long, float,
CS0007: Introduction to Computer Programming Primitive Data Types and Arithmetic Operations.
CompSci 100E JB1.1 Java Basics (ala Goodrich & Tamassia)  Everything is in a class  A minimal program: public class Hello { public static void main(String[]
Eastside Robotics Alliance / Newport Robotics Group 1 T/Th, 6:30 – 8:30 PM Big Picture School Day 3 · 10/9/2014.
Information and Computer Sciences University of Hawaii, Manoa
Key Words / Reserved Words
Chapter 2 Basic Computation
Introduction to Computer Science / Procedural – 67130
2.5 Another Java Application: Adding Integers
Multiple variables can be created in one declaration
An Introduction to Java – Part I
Starting JavaProgramming
An Introduction to Java – Part I, language basics
Fundamental OOP Programming Structures in Java: Comments, Data Types, Variables, Assignments, Operators.
Fundamental Programming
In this class, we will cover:
IAT 800 Foundations of Computational Art and Design
Just Enough Java 17-May-19.
LCC 6310 Computation as an Expressive Medium
Problem 1 Given n, calculate 2n
COMPUTING.
Presentation transcript:

AP Computer Science Anthony Keen

Computer 101 What happens when you turn a computer on? –BIOS tries to start a system loader –A system loader tries to start an operating system.

Java 101 What happens when you run a program? You tell the operating system to run a program called java.exe with a command line argument, your program. Java starts up and then calls your main method.

Where does a program start? public static void main(String[] args) –public = anyone can call this method –static = you dont need an instance to call this method –void = this method doesnt return anything –main = the name of the method –String[] = this function takes an array of Strings as its parameter –args = the name of our array

Primitives int –Holds an Integer float, double –Holds a decimal value char –Holds a single character boolean –Holds true or false

Sequential Programming The statements within a function (like main) are executed in order.

Conditional Statements if(boolean) { // stuff } –if the boolean is true, then we execute the code inside the curly braces

Conditional Statements if(boolean) { // stuff } else { // different stuff } –if the boolean is false, then we execute the code inside the elses curly braces

Conditional Statements switch(int) { case 0: // stuff break; case 1: // other stuff break; default: // default stuff }

Looping Structures while (boolean) { // Stuff } While the boolean value is true, we will keep doing whatever is inside the whiles curly braces.

Looping Structures Typical Use: int count = 0; while (count < 10) { // Stuff count++; // count = count + 1; }

Looping Structures for (initialize; condition; increment) { // Stuff }

Looping Structures Typical use for (int i = 0; i < 10; i++) { // Stuff }

Input / Output Input –JOptionPane.showInputDialog ( … ) Output –System.out.print ( … ) –System.out.println ( … ) Escape Codes –\n = New Line –\t = Tab

In Review Primitives Sequential Programming Conditional Statements Looping Structures Input / Output

Operators =, is assigned to +, add numbers or concatenate Strings -, subtract numbers *, multiply numbers /, divide numbers %, divide numbers and give the remainder

Logic Operators &&, AND ||, OR ==, equal to !=, not equal to &, bitwise AND |, bitwise OR <, less than >, greater than

What else have we covered?