XJV1NS0627 InstructorPhilipM-1 Object Application (Project) Factory PROVIDER (api/external) Service (inject > Classes) Class (export > import) Contacts Object Contact > Contacts.Contact data type (String) var (fname) arg > param data type (int) var (age) Contacts.Contact.age fname = "Philip" > "Philip" value value>arg age = 30 > 30 value if > values if elif elif else for > type and var do > param and Objects switch > param and Objects try > Class Objects if else else if statement > conditions boolean if (condition) { encapsulate true; // 27 steps } else if (condition) { // true } else { // false } switch statement > evaluate value expression dayOfWeek = "A" switch (expression) { case value1: Monday case value2: Tuesday case 3: Wed default: "what you would think of else" } if else > statement switch case > statement loops > for or do for (init, condition, update) { return } Belong to themselves "Return themself" variable x (mutable / R/W) String x = "Philip" immutable variable y (immutable / R) final int y = 10 variable Return class static variables > return to class cartTotal = 210.36 > class > process cc dec (init) something declaration value value returned JavaCustom Google Chrome intellij download Free Community Version myBasics.java class myBasics { myBasics() { // constructor } } underscore_case var TitleCase Class Objects UPPERCASE PROVIDERS lowercase camelCase function / methods void > void the obj in memory null defined any > returns BUT leaves obj in memory !nulls boolean > true false myIfElse() tuple(p1,p2) I.C.C.C.O.O.O.m.m.m.m.m.prop.value.m() int num = 10; value.toString() "10" type var > Object Class varName data type var > Property int varName ContactInfo Class 4 that you need fname lname add city ContactDetails age bday ContactData CI CD void any boolean BUT general "return" OOP Chapters Class MyBasics Main 1. template > structure MyBasicsS 2. blueprint > functional MyBasicsF Class Objects > instance of the Class new Object > attributes behaviors Base 5: 1. Data (Attribute) 2. Method / Methods (behaviors) 3. Object Creation ContactInfo Objects ContactDetails Objects 4. Encapsulation { multiple exp } 5. Inheritance hierachies Inner P > C Day 2 > Inner Classes 8:30 CST Tonight > Upload Java code Be on at 8 CST 8 CST - 8:30 CST code debugging Day 1 Code is located at: https://onlclabs.com/java/ click on Java06272023 Be advised, if you naming scheme is different than mine, you need to update your code. Inner Classes class Super { z class sub { x y S.z } logically } Types of Inner Classes 1. Member Inner Class S.z 2. Static Nested Class Not access S.Z inst = new Super 3. Local Inner Class mymethod() { int v; lic name { v } } 4. Anonymous Inner Class one time use "lambda expression" anony function Recursive Methods "same type" > Big Problem > divide it into smaller subproblems of the same type > complex tasks break them down smaller tasks Base Case: requirement, condition terminates and then does the return Recursive Case: "method" steps same type returned to the base case Method call: define chars of the method control var = 1 switch (exp): case 1: op1; method1() op2; op3; case 2 : method1() base 5 5 recr1 4 5-1 4 9 n + sum(n-1) recr2 3 4-1 3 12 recr3 2 3-1 2 14 recr4 1 2-1 1 15 recr5 0 1-1 0 "term not pos num" terminate back to base > result sum(control) > 15 control = 5 control - 1 Override Methods SuperClass method1() SubClass method1() Inhert attributes BUT override value @Override method1() class Person SuperClass school = "onlc" whoAmI() { S.o.p("person" + school) } class Student extends Person whoAmI() { S.o.p("student" + school) } class Instructor extends Person whoAmI() { S.o.p("instructor" + school) } Class = new Class(); execute external class Class { Class {} } execute internal class Class extend Class override methods in a class Interface extends Class interface dependent class person(fname, lname) @Override person(add, city, state , zip) Interface 1. depends on another Class 2. declared interface InterfaceName 3. implicitly imply public or abstract 4. Poly > inherit the class depending on 5. constants > passed to class immutable R mutable R/W Optional param Override() setting default String fname Optional fname Collections Set of classes (data sets) interfaces List ArrayList LinkedList Charaterists 1. indexed Array["bob","joe"] 0,1 2. sorted "Ohio","Florida" ? "Florida","Ohio" 3. singular or key:value or attr:value fname: "Philip" dict/map 4. duplicated "Bob","Joe,"Bob" 5. immutable vs mutable (a1, a2, a3) immutable methodName(p1,p2,p3) 6. Syntax [] > Array or ArrayList [ { } ] {} > List { k:v } or { a:v } > Dict or Maps () > tuples 1. ArrayList[] > ordered, indexed, dups, mutable 2. TreeSet{} or HashSet{} > unordered, !dup, mutable 3. Map{k:v} > key!dup: valuedup String fname = "Philip" String ClassType fname varName ArrayList String fname = "Philip" ClassType ClassType varName = value Class(value) ArrayList fname = new ArrayList() for (String ordersx : orders1) { System.out.println(ordersx) } "Apples": 5 "Bananas": 2 Map varName = new HashMap<>(); 1. meta 2. property 3. members < Properties (external file .properties) attr=value Regular Expressions regex101.com 1. String Literal String "Bob" char[] ['B','o','b'] [a-z][A-Z][0-9] 2. Metachars `.` `*` `+` `?` `|` 3.Quantifies 10,10,10,8,10 10 as 4 `{n}` n=4 exact `{n,} n=4 `{n,m}` n=4 m=8 4. Anchors ^ beginning of the line ^[Phi] $ end of the line \b word boundary Philip Matusiak ^\w + @ [a-zA-Z_] + ?\.[a-zA-Z]{2,3}$ ^begins with a-zA-Z0-9_ philipm + @ @ + [a-z][A-Z_] onlc + \. . [a-zA-Z] {2,3} com $end Wrap Up Zip files: C:\Users\Student\IdeaProjects\*yourfolder gotomypc toolbar Tools>Transfer site: onlclabs.com/java Books chapter 1-8 philipm@onlc.com onlc.com/eval Certificate of Completion