introduction to java
TRANSCRIPT
![Page 1: Introduction to java](https://reader030.vdocuments.mx/reader030/viewer/2022032619/55c34678bb61ebe4438b4846/html5/thumbnails/1.jpg)
Origin of Android
Android Inc. was founded by “Andy Rubin” in October 2003
GOOGLE acquired Android Inc. on August 17, 2005
![Page 2: Introduction to java](https://reader030.vdocuments.mx/reader030/viewer/2022032619/55c34678bb61ebe4438b4846/html5/thumbnails/2.jpg)
Introduction to Android Android is a open source
(os) Platform powered by
Linux os Developed in Java and
xml
Application
LINUX Kernel
CPU Memory
Devices
Basic Fundament Of Android
![Page 3: Introduction to java](https://reader030.vdocuments.mx/reader030/viewer/2022032619/55c34678bb61ebe4438b4846/html5/thumbnails/3.jpg)
TabletMobile device Android- auto
Android-TV Android-Camera
Types of Android Devices
Android-Gear
![Page 4: Introduction to java](https://reader030.vdocuments.mx/reader030/viewer/2022032619/55c34678bb61ebe4438b4846/html5/thumbnails/4.jpg)
Versions
Eclair
Froyo Gingerbread
GingerbreadLollipop preview
Donut
Jelly bean
Kitkat
Honeycomb Icecreamsandwich
Name Version
Alpha 1.0
Beta 1.1
Cupcake 1.5
Donut 1.6
Eclair 2.1
Froyo 2.2
Gingerbread 2.3
Honeycomb 3.0
Icecream sandwich 4.0
Jelly bean 4.2
Kitkat 4.4
Lollipop 5.0.2
![Page 5: Introduction to java](https://reader030.vdocuments.mx/reader030/viewer/2022032619/55c34678bb61ebe4438b4846/html5/thumbnails/5.jpg)
Application Development Steps
Download and Install the JDK Install Android Studio and Android SDK http://developer.android.com
![Page 6: Introduction to java](https://reader030.vdocuments.mx/reader030/viewer/2022032619/55c34678bb61ebe4438b4846/html5/thumbnails/6.jpg)
Coding in android
Java -(logic) Xml-(layout)
• Java is used for dynamical changes • Xml is used for static layout
![Page 7: Introduction to java](https://reader030.vdocuments.mx/reader030/viewer/2022032619/55c34678bb61ebe4438b4846/html5/thumbnails/7.jpg)
Why Java is Important
JAVA Object Oriented Programming
Two reasons : Trouble with C/C++ languages is that
they are not portable and are not platform independent languages
Emergence of World Wide Web which demanded Portability and security necessitated the invention of Java
![Page 8: Introduction to java](https://reader030.vdocuments.mx/reader030/viewer/2022032619/55c34678bb61ebe4438b4846/html5/thumbnails/8.jpg)
Java is architecture-neutral
JAVA Program Execution
![Page 9: Introduction to java](https://reader030.vdocuments.mx/reader030/viewer/2022032619/55c34678bb61ebe4438b4846/html5/thumbnails/9.jpg)
Structure
Class Name
Class body
Class member instancevariable
Access modifier
Class member instancemethod
![Page 10: Introduction to java](https://reader030.vdocuments.mx/reader030/viewer/2022032619/55c34678bb61ebe4438b4846/html5/thumbnails/10.jpg)
Access ModifiersAccess modifiers used to set access levels for classes, variables, methods and constructors. The four access levels are:•Visible to the package. the default. No modifiers are needed•Visible to the class only (private)•Visible to the world (public)•Visible to the package and all subclasses (protected)
![Page 11: Introduction to java](https://reader030.vdocuments.mx/reader030/viewer/2022032619/55c34678bb61ebe4438b4846/html5/thumbnails/11.jpg)
Hello world Program in java
Lets Get Started
public class hello {
public static void main(String [] args) { System.out.println("Hello World"); }}
![Page 12: Introduction to java](https://reader030.vdocuments.mx/reader030/viewer/2022032619/55c34678bb61ebe4438b4846/html5/thumbnails/12.jpg)
How to get it running
Save the file with hello.java Why?
To compile: javac hello.java
To run: java hello
![Page 13: Introduction to java](https://reader030.vdocuments.mx/reader030/viewer/2022032619/55c34678bb61ebe4438b4846/html5/thumbnails/13.jpg)
Variablespublic class hello{
public static void main(String []args) {String color;int speed;color="red";speed=150;System.out.println("color of car is "+
color);System.out.println("speed of car is
"+ speed); }}
![Page 14: Introduction to java](https://reader030.vdocuments.mx/reader030/viewer/2022032619/55c34678bb61ebe4438b4846/html5/thumbnails/14.jpg)
Objectclass vehicle{
String color;int speed;
}public class hello { public static void main(String []args) {
vehicle obj = new vehicle();obj.color ="red";obj.speed = 150;System.out.println("color of car is
"+obj.color);System.out.println("speed of car is
"+obj.speed); }}
![Page 15: Introduction to java](https://reader030.vdocuments.mx/reader030/viewer/2022032619/55c34678bb61ebe4438b4846/html5/thumbnails/15.jpg)
Multiple Objectsclass vehicle{
String color; int speed;
}public class hello { public static void main(String []args) {
vehicle obj = new vehicle();obj.color="red“; obj.speed =150;vehicle obj2 =new vehicle();obj2.color="blue“; obj2.speed =180;System.out.println("color of car is
"+obj.color+","+obj2.color); System.out.println("speed of car is "+obj.speed+","+obj2.speed); }}
![Page 16: Introduction to java](https://reader030.vdocuments.mx/reader030/viewer/2022032619/55c34678bb61ebe4438b4846/html5/thumbnails/16.jpg)
Static variableclass vehicle{
static String color; static int speed;
}public class hello { public static void main(String []args) {
vehicle obj = new vehicle();obj.color="red“; obj.speed =150;vehicle obj2 =new vehicle();obj2.color="blue“; obj2.speed =180;System.out.println("color of car is
"+obj.color+","+obj2.color); System.out.println("speed of car is "+obj.speed+","+obj2.speed); }}
![Page 17: Introduction to java](https://reader030.vdocuments.mx/reader030/viewer/2022032619/55c34678bb61ebe4438b4846/html5/thumbnails/17.jpg)
Methodclass vehicle{
public void attributes(){System.out.println("hello");
} }public class hello { public static void main(String []args) {
vehicle obj = new vehicle();obj.color="red“; obj.speed =150;vehicle obj2 =new vehicle();obj2.color="blue“; obj2.speed =180;obj2.attributes();
} }
![Page 18: Introduction to java](https://reader030.vdocuments.mx/reader030/viewer/2022032619/55c34678bb61ebe4438b4846/html5/thumbnails/18.jpg)
Static Methodclass vehicle{
public static void attributes(){System.out.println("hello");
} }public class hello { public static void main(String []args) {
vehicle obj = new vehicle();obj.color="red“; obj.speed =150;vehicle obj2 =new vehicle();obj2.color="blue“; obj2.speed =180; vehicle.attributes();
} }
![Page 19: Introduction to java](https://reader030.vdocuments.mx/reader030/viewer/2022032619/55c34678bb61ebe4438b4846/html5/thumbnails/19.jpg)
Constructorclass vehicle{
public vehicle(){System.out.println("constructor
called");} }
public class hello { public static void main(String []args) {
vehicle obj = new vehicle();obj.color="red“; obj.speed =150;vehicle obj2 =new vehicle();obj2.color="blue“; obj2.speed =180;}
}
![Page 20: Introduction to java](https://reader030.vdocuments.mx/reader030/viewer/2022032619/55c34678bb61ebe4438b4846/html5/thumbnails/20.jpg)
Inheritance
parent
child
class vehicle{void attributes(){
System.out.println("color of car is "+color);
System.out.println("speed of car is "+speed);} }class car extends vehicle{
String cc;public void details(){ attributes();System.out.println(“volume of car is = "+cc);
} }public class hello { public static void main(String []args) {
car maruti= new car();maruti.color = "red";maruti.speed = 150;maruti.cc= "800 cc";maruti.details();
} }
![Page 21: Introduction to java](https://reader030.vdocuments.mx/reader030/viewer/2022032619/55c34678bb61ebe4438b4846/html5/thumbnails/21.jpg)
If / Elseif (logic condition) {something}else if (logic condition) { something}else {something else}
![Page 22: Introduction to java](https://reader030.vdocuments.mx/reader030/viewer/2022032619/55c34678bb61ebe4438b4846/html5/thumbnails/22.jpg)
Switch switch(variable){
case(1): something;break;
case(23): something;break;
default: something;}
![Page 23: Introduction to java](https://reader030.vdocuments.mx/reader030/viewer/2022032619/55c34678bb61ebe4438b4846/html5/thumbnails/23.jpg)
For loopfor ( initialization , condition , iteration){//do something}
for ( int i=0 ; i<20 ; i++ ) {System.out.println(“change in value");}
![Page 24: Introduction to java](https://reader030.vdocuments.mx/reader030/viewer/2022032619/55c34678bb61ebe4438b4846/html5/thumbnails/24.jpg)
Whilewhile( condition ){//do something}
while (i<20){System.out.println(“value");i++;}
![Page 25: Introduction to java](https://reader030.vdocuments.mx/reader030/viewer/2022032619/55c34678bb61ebe4438b4846/html5/thumbnails/25.jpg)
CastingCasting is the method to convert type of the variable.Class typecast{public static void main(String []args) {
int a=5;float c;c=(float)a/2; // using(float) is type
casting }}
![Page 26: Introduction to java](https://reader030.vdocuments.mx/reader030/viewer/2022032619/55c34678bb61ebe4438b4846/html5/thumbnails/26.jpg)
Questions ?
Thank you