introduction to core java programming

13
Introduction to Core Java Programming www.collaborationtech.co.in Bengaluru INDIA Presentation By Ramananda M.S Rao

Upload: raveendra-r

Post on 13-Apr-2017

35 views

Category:

Technology


1 download

TRANSCRIPT

Page 1: Introduction to Core Java Programming

Introduction to Core Java Programming

www.collaborationtech.co.inBengaluru INDIA

Presentation By Ramananda M.S Rao

Page 2: Introduction to Core Java Programming

Introduction to JavaScript BasicsContentOverviewGet StartedVariables & DeclarationJava StatementsJava Data Types Control StructuresKeyboard InputRegular ExpressionsJava Exceptions and LoggingFiles and SerializationJava Utility Objects and API’sObject Oriented ProgrammingJava CollectionsJava ThreadsGUI - Awt and Swing Database ConnectivitySimple NetworkingNew Features JDK 1.8Development ToolsAbout Us

www.collaborationtech.co.in

Page 3: Introduction to Core Java Programming

OverviewWhat is Java? Java is a programming language designed for use in the distributed

environment of the Internet. Programming language developed for the Web. Programming language Developed by James Gosling. Sun Microsystems released java in 1995 as a core component of

Sun Java technology. Java is very versatile, efficient, platform independent and secure. Java is write once and run anywhere. About 2 billion Devices using Java in various applications. Java is used in Embedded devices, Mobile phones, Enterprise

Servers, Super computers, Web Servers and Enterprise Appls. These features makes java technology ideal for network computing.

www.collaborationtech.co.in

Page 4: Introduction to Core Java Programming

Get StartedJava programs 1. Applications 2. Applets. Application Program : Java applications are more general programs written in the Java

language. Java can be used to create all kinds of applications.Applet Program: Applets are Java programs that are downloaded over the World

Wide Web and executed by a java enabled Web browser. Applet is an window based program which can be executed inside

another application called a browser. Program compiled using javac compiler and converted into an class

file Class file name is then included in the applet tag’s code attribute in an html file.

Java Applets makes the application more dynamic and interactive.www.collaborationtech.co.in

Page 5: Introduction to Core Java Programming

Get Started// html file to show results in browser – FirstHTML.html <html><body><applet code="FirstApplet.class" WIDTH=500 HEIGHT=500></applet></body></html> <applet code=" FirstApplet.class" width=500 height=500></applet> This tells the browser to load the applet whose compiled code is in FirstApplet.class (in the same directory as the current HTML document), and to set the initial size of the applet to 500 pixels wide and 500 pixels high

www.collaborationtech.co.in

Page 6: Introduction to Core Java Programming

Variables, Declaration, & StatementsJava Variables Primitive Datatypes Declarations Variable Names Numeric Literals Character Literals String String Literals Arrays Non-Primitive Datatypes The Dot Operator Character Literals:For characters that cannot be entered directly we use escape sequences.Description \ddd octal characters ( ddd )\uxxxx hexadecimal characters\’ single quote\” double quote\\backslash\r carriage return\n new line\f form feed\t tab\b backspace

www.collaborationtech.co.in

Page 7: Introduction to Core Java Programming

Java Data Types Java Data Types Java is what is known as a strongly typed language. That means that Java is a language that will only accept specific values within specific variables or parameters.

Java (strongly typed) 1: int x; // Declare a variable of type int 2: x = 1; // Legal 3: x = "Test" // Compiler Error 4: x = true; // Compiler ErrorThere are 9 data types in Java, 8 primitive types and a reference type

www.collaborationtech.co.in

Page 8: Introduction to Core Java Programming

Java Data Types Java Primitive Typesboolean, char, byte, short, int, long, float , doubleReference TypesBasically, anything that is not a primitive (an int, a float, etc.) is a reference. That means that arrays are references, as are instances of classes. The variable that you create does not have the object you've created in it. Rather, it has a reference to that object in it. 1: // Create a new object and store it in a variable 2: MyClass anInstanceOfMyClass = new MyClass();Objects and Arrays are reference types Primitive types are stored as valuesReference type variables are stored as references (pointers that we can’t mess with)

www.collaborationtech.co.in

Page 9: Introduction to Core Java Programming

Java Data Types Passing arguments to methodsPrimitive types: the method gets a copy of the value. Changes won’t show up in the caller Pass by value Reference typesThe method gets a copy of the reference, the method accesses the same object Pass by reference There is no pass by pointers!

Casting:Because Java is a strongly typed language, it is sometimes necessary to perform a cast of a variable. Casting is the explicit or implicit modification of a variable's type. Casting allows us to view the data within a given variable as a different type than it was given. Example: 1: short x = 10; 2: int y = (int)x;

www.collaborationtech.co.in

Page 10: Introduction to Core Java Programming

Keyboard Input// Keyboard Inputimport java.util.Scanner; public class MyScanner {

public static void main(String args[]) {

Scanner ragh = new Scanner(System.in);System.out.println("Enter the length");double rlength,rwidth,rarea;rlength = ragh.nextDouble();System.out.println("Enter the width");rwidth = ragh.nextDouble();rarea= (rlength*rwidth);System.out.println("Area is ="+rarea);

}

}

www.collaborationtech.co.in

Page 11: Introduction to Core Java Programming

Keyboard Input// Keyboard Inputimport java.io.BufferedReader;import java.io.IOException;import java.io.InputStreamReader; public class KeyboardBufferedInput {

public static void main (String args[]) throws IOException{ String s1 =null;

String s2=null;double a;System.out.print("enter the length:");BufferedReader br=new BufferedReader(new InputStreamReader(System.in));s1=br.readLine();double l=Integer.parseInt(s1);System.out.print("enter the breadth:");s2= br.readLine();double w=Integer.parseInt(s2);a=l*w;System.out.print("area is="+a);

} }

www.collaborationtech.co.in

Page 12: Introduction to Core Java Programming

Follow us on SocialFacebook: https://www.facebook.com/collaborationtechnologies/Twitter : https://twitter.com/collaboration09Google Plus : https://plus.google.com/100704494006819853579LinkedIn : https://www.linkedin.com/in/ramananda-rao-a2012545Instagram : https://instagram.com/collaborationtechnologiesYouTube : https://www.youtube.com/channel/UCm9nK56LRbWSqcYWbzs8CUgSkype : msrnandaWhatsApp : +91 9886272445

www.collaborationtech.co.in

THANK YOU

Page 13: Introduction to Core Java Programming

About Us