java basics kris secor mobile application development
TRANSCRIPT
![Page 1: Java Basics Kris Secor Mobile Application Development](https://reader035.vdocument.in/reader035/viewer/2022071807/56649de85503460f94ae2356/html5/thumbnails/1.jpg)
ART40544Java BasicsKris Secor
Mobile Application Development
![Page 2: Java Basics Kris Secor Mobile Application Development](https://reader035.vdocument.in/reader035/viewer/2022071807/56649de85503460f94ae2356/html5/thumbnails/2.jpg)
Can Break a Man (or woman!)… Best thing to do is dive in… Don’t show fear in the courtyard Learn Some Programming anddive in to app development assoon as possible.
Mobile Application Development
Mobile Development...
![Page 3: Java Basics Kris Secor Mobile Application Development](https://reader035.vdocument.in/reader035/viewer/2022071807/56649de85503460f94ae2356/html5/thumbnails/3.jpg)
6:30-7:00 - Course intro (Text/Screencast channel/requirements)
7:00-7:30 The tools/resources (Android Studio/Eclipse/Java/Android SDK/developer.android.com/compileonline/)
7:30-7:45 Quick break to get refreshed.
7:45-8:15- Install and tour
8:15-9:30- Running Java/Variables/Data/Operators/Conditionals/Scanner Classes Exercises and Homework
Mobile Application Development
Tonight’s plan:
![Page 4: Java Basics Kris Secor Mobile Application Development](https://reader035.vdocument.in/reader035/viewer/2022071807/56649de85503460f94ae2356/html5/thumbnails/4.jpg)
The Java we'll need to learn first is:
The core language Collections IO String handling We will not need to learn Servlets or Swing
or a few other java concepts as this is about developing for android
Mobile Application Development
Java for Android is specific
![Page 5: Java Basics Kris Secor Mobile Application Development](https://reader035.vdocument.in/reader035/viewer/2022071807/56649de85503460f94ae2356/html5/thumbnails/5.jpg)
Learn to write simple code Learn to understand complex code Understand and accept encapsulation and
be able to use the android libraries Get experience at troubleshooting Get one app under our belts Have realistic expectations
Mobile Application Development
Goals for an intro course
![Page 6: Java Basics Kris Secor Mobile Application Development](https://reader035.vdocument.in/reader035/viewer/2022071807/56649de85503460f94ae2356/html5/thumbnails/6.jpg)
Mm214.com The texts Eclipse. Feel free to download Kepler. I use
indigo. You can read why here Android SDK. We will download this in a
couple of weeks. Emulators Java Docs Java Docs for Android Snippets
Mobile Application Development
Let’s look at the tools
![Page 7: Java Basics Kris Secor Mobile Application Development](https://reader035.vdocument.in/reader035/viewer/2022071807/56649de85503460f94ae2356/html5/thumbnails/7.jpg)
Basic Java Syntax
![Page 8: Java Basics Kris Secor Mobile Application Development](https://reader035.vdocument.in/reader035/viewer/2022071807/56649de85503460f94ae2356/html5/thumbnails/8.jpg)
Primitive Types and Variables
boolean, char, byte, short, int, long, float, double etc.
These basic (or primitive) types are the only types that are not objects (due to performance issues).
This means that you don’t use the new operator to create a primitive variable.
Declaring primitive variables:float initVal;int retVal, index = 2;double gamma = 1.2, brightnessboolean valueOk = false;
![Page 9: Java Basics Kris Secor Mobile Application Development](https://reader035.vdocument.in/reader035/viewer/2022071807/56649de85503460f94ae2356/html5/thumbnails/9.jpg)
Initialization If no value is assigned prior to use, then
the compiler will give an error Java sets primitive variables to zero or
false in the case of a boolean variable All object references are initially set to null An array of anything is an object
◦ Set to null on declaration◦ Elements to zero false or null on creation
![Page 10: Java Basics Kris Secor Mobile Application Development](https://reader035.vdocument.in/reader035/viewer/2022071807/56649de85503460f94ae2356/html5/thumbnails/10.jpg)
Declarationsint index = 1.2; // compiler errorboolean retOk = 1; // compiler errordouble fiveFourths = 5 / 4; // no error!float ratio = 5.8f; // correctdouble fiveFourths = 5.0 / 4.0; // correct
1.2f is a float value accurate to 7 decimal places. 1.2 is a double value accurate to 15 decimal
places.
![Page 11: Java Basics Kris Secor Mobile Application Development](https://reader035.vdocument.in/reader035/viewer/2022071807/56649de85503460f94ae2356/html5/thumbnails/11.jpg)
All Java assignments are right associative
int a = 1, b = 2, c = 5a = b = c
System.out.print(“a= “ + a + “b= “ + b + “c= “ + c)
What is the value of a, b & c Done right to left: a = (b = c);
Assignment
![Page 12: Java Basics Kris Secor Mobile Application Development](https://reader035.vdocument.in/reader035/viewer/2022071807/56649de85503460f94ae2356/html5/thumbnails/12.jpg)
Basic Mathematical Operators
* / % + - are the mathematical operators * / % have a higher precedence than + or -double myVal = a + b % d – c * d / b; Is the same as:double myVal = (a + (b % d)) –
((c * d) / b);
![Page 13: Java Basics Kris Secor Mobile Application Development](https://reader035.vdocument.in/reader035/viewer/2022071807/56649de85503460f94ae2356/html5/thumbnails/13.jpg)
Statements & Blocks
A simple statement is a command terminated by a semi-colon:name = “Fred”;
A block is a compound statement enclosed in curly brackets:{
name1 = “Fred”; name2 = “Bill”;}
Blocks may contain other blocks
![Page 14: Java Basics Kris Secor Mobile Application Development](https://reader035.vdocument.in/reader035/viewer/2022071807/56649de85503460f94ae2356/html5/thumbnails/14.jpg)
Flow of Control Java executes one statement after the
other in the order they are written Many Java statements are flow control
statements:Alternation: if, if else, switchLooping: for, while, do whileEscapes: break, continue, return
![Page 15: Java Basics Kris Secor Mobile Application Development](https://reader035.vdocument.in/reader035/viewer/2022071807/56649de85503460f94ae2356/html5/thumbnails/15.jpg)
Open Eclipse and Create a new Java project Lets focus on output. Then variables and data typing Then user entry using the Scanner class Then some logic problems
Mobile Application Development
Now Let’s Play!