AP Java Unit 3 Strings & Arrays.

Slides:



Advertisements
Similar presentations
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.
Advertisements

STRING AN EXAMPLE OF REFERENCE DATA TYPE. 2 Primitive Data Types  The eight Java primitive data types are:  byte  short  int  long  float  double.
Recursion CS 367 – Introduction to Data Structures.
Computer Science 209 Software Development Equality and Comparisons.
Constants A constant is a variable whose value is expected to remain the same throughout a program It is considered “good programming style” to use constants.
Week 2: Primitive Data Types 1.  Programming in Java  Everything goes inside a class  The main() method is the starting point for executing instructions.
Chapter 3 Using Classes and Objects. 2 Creating Objects  A variable holds either a primitive type or a reference to an object  A class name can be used.
Working with the data type: char  2000 Prentice Hall, Inc. All rights reserved. Modified for use with this course. Introduction to Computers and Programming.
The Class String. String Constants and Variables  There is no primitive type for strings in Java.  There is a class called String that can be used to.
Introduction to Computers and Programming Strings Professor: Evan Korth New York University.
MATHEMATICS Adding & Subtracting with Fractions. Lesson Objectives The aim of this powerpoint is to help you… to add fractions to subtract fractions.
Week 10 - Monday.  What did we talk about last time?  Method overloading  Lab 9.
Java Data Types. Primitive Data Types Java has 8 primitive data types: – char: used to store a single character eg. G – boolean: used to store true or.
1 BUILDING JAVA PROGRAMS CHAPTER 7.1 ARRAY BASICS.
Java Basics.  To checkout, use: svn co scb07f12/UTORid  Before starting coding always use: svn update.
Factoring How many terms do I have? 2 3Use trinomial method You have narrowed It down to: GCF or DOTS Do they have something in common? (AKA Do I see a.
 Structures are like arrays except that they allow many variables of different types grouped together under the same name. For example you can create.
In Java.... Variables contain the values of primitive data types Value Types.
String Class. Variable Holds a primitive value or a reference to an object. Holds a primitive value or a reference to an object. A reference lets us know.
Road map char data type Reading –Liang 5: Chapter 2: 2.7.4; 2.9; –Liang 6: Chapter 2: 2.7.4; 2.9 –Liang 7: Chapter 2: 2.7.4; 2.9.
CSC 142 F 1 CSC 142 References and Primitives. CSC 142 F 2 Review: references and primitives  Reference: the name of an object. The type of the object.
Week 10 - Monday.  What did we talk about last time?  Method overloading  Lab 9.
Declaring variables The type could be: int double char String name is anything you want like lowerCaseWord.
Lab String Concatenation String s3 = s1.concat(s2); String s3 = s1 + s2; s1 + s2 + s3 + s4 + s5 same as (((s1.concat(s2)).concat(s3)).concat(s4)).concat(s5);
Quiz Title Your name goes here. Question 1 Click here for answer Click here for answer Go to question 2 Go to question 2.
CompSci Announcements  Read Chap 3 for next time  Homework will be posted  Consulting Hours will start soon.
D. Phát triển thương hiệu
Điều trị chống huyết khối trong tai biến mạch máu não
BÖnh Parkinson PGS.TS.BS NGUYỄN TRỌNG HƯNG BỆNH VIỆN LÃO KHOA TRUNG ƯƠNG TRƯỜNG ĐẠI HỌC Y HÀ NỘI Bác Ninh 2013.
HF NOISE FILTERS PERFORMANCE
Parameterization of Tabulated BRDFs Ian Mallett (me), Cem Yuksel
Bayesian Confidence Limits and Intervals
Current State of Japanese Economy under Negative Interest Rate and Proposed Remedies Naoyuki Yoshino Dean Asian Development Bank Institute Professor Emeritus,
yaSpMV: Yet Another SpMV Framework on GPUs
Java String Methods - Codehs
Agenda Warmup Lesson 1.4 (double precision, String methods, etc)
More Events.
Introduction to Java part 2
Building Java Programs
Foundations of Programming: Arrays
Multiple variables can be created in one declaration
Computer Science 3 Hobart College
Wrapper Classes ints, doubles, and chars are known as primitive types, or built-in types. There are no methods associated with these types of variables.
CSC 253 Lecture 8.
String Objects & its Methods
Lesson 2: Building Blocks of Programming
AP Java Unit 3 Strings & Arrays.
Arrays.
CSC 253 Lecture 8.
Unit-2 Objects and Classes
Introduction to Java part 2
ArrayLists.
Object-Oriented Programming Paradigm
Parameter Passing in Java
Declaring Variables – Mod 4
Barb Ericson Georgia Institute of Technology Oct 2005
slides created by Ethan Apter
Java for Beginners University Greenwich Computing At School DASCO
Introduction to Java part 2
Java’s Central Casting
2009 Test Key.
Java: Variables, Input and Arrays
Object Oriented Programming
Learn to solve equations with integers.
Welcome back! March 21, 2019.
The dog and cat are hungry.
Just Basic Lessons Mr. Kalmes.
Structures in c By Anand George.
Just Basic Lessons 8 Mr. Kalmes.
More on iterations using
Presentation transcript:

AP Java Unit 3 Strings & Arrays

Lesson 5: Arrays of objects

In Java arrays can hold either primitive data or object data. Arrays of objects Click for Help Primitive? Primitive data are values like ints or chars. The variable can only hold one thing at a time. In Java arrays can hold either primitive data or object data. Object? In Java an Object is a variable of a class type. It can hold lots of data and has methods. It is different then a primitive type.

Examples: Arrays of objects String movies[] = new String[5]; movies[0] = “Maltese Falcon”; System.out.print(list[0].length); Dot operator goes after the [ ] Prints 14

Answers Now you try some: Use this array: String movies[] = new String[5]; Now you try some: Add the movie “Don’t Eat the Daisies” to the second spot. Print the charAt(3) for the movie in the second spot. Print the movie in the first spot in all uppercase letters. #1 movies[1] = “Don’t Eat the Daisies”; Remember 1 is the second spot in the array since the array starts at 0 #2 System.out.print(movies[1].charAt(3)); Answers #3 System.out.print(movies[0].toUpperCase());