java

14
13-05-2013 Rajavel D Java Summer Internship 2013 (Indian Institute of Technology Bombay)

Upload: rajavel-evergreen

Post on 01-Nov-2014

482 views

Category:

Education


0 download

DESCRIPTION

Java Basic presentation

TRANSCRIPT

Page 1: Java

13-05-2013 Rajavel D Rajavel D

Java

Summer Internship – 2013

(Indian Institute of Technology Bombay)

Page 2: Java

Java

Object-Oriented

Platform independent

Simple

Secure

Multi-threaded

High Performance

Rajavel D Java IITB-CSE-Internship 2013

Page 3: Java
Page 4: Java

Basic terms

Object - Objects have states and behaviors.

Class - A class can be defined as a blue print that describe the behaviors/states that object.

Methods - A method is basically a behavior.

Instance Variables - States of an objects, each object has its unique set of instance variables.

Rajavel D Java IITB-CSE-Internship 2013

Page 5: Java

Keep in Mind

Case Sensitivity - Hello and hello would have different meaning in Java.

Class Names - For all class names the first letter should be in Upper Case. Example : class MyFirstJavaClass

Method Names - All method names should start with a Lower Case letter and each inner word's first letter should be in Upper Case. Example : public void myMethodName()

Program File Name - Name of the program file should exactly match the class name.

Rajavel D Java IITB-CSE-Internship 2013

Page 6: Java

Simple Program

class HelloWorldApp {

public static void main(String[] args) {

HelloWorldApp hello = new HelloWorldApp();

hello.sayHello();

}

public void sayHello(){

System.out.println(“Hello”);

}

}

O/P : Hello

Rajavel D Java IITB-CSE-Internship 2013

Page 7: Java

Modifiers and Variables

Access Modifiers :

default, public , protected, private

Non-access Modifiers :

final, abstract, static, strictfp, synchronized and volatile

Type of variables in Java:

Local Variables

Class Variables (Static Variables)

Instance Variables (Non static variables)

Rajavel D Java IITB-CSE-Internship 2013

Page 8: Java

public static void main ?

java program processing starts from the main()

method.

Public ?

Static?

Void?

Rajavel D Java IITB-CSE-Internship 2013

Page 9: Java

Object Oriented Principles

Abstraction

Hiding the implementation (abstract class and interface)

Encapsulation

Wrapping up of data into single unit. (data hiding)

Inheritance

Reusable the properties of existing class

Polymorphism

Overloading and Overriding

Rajavel D Java IITB-CSE-Internship 2013

Page 10: Java

Thread

Create Thread by implements Runnable interface or

extends Thread class

Rajavel D Java IITB-CSE-Internship 2013

Page 11: Java

Exception Handling

Problem that

arises during the

execution of a

program.

try{}

catch{}

finally{}

Rajavel D Java IITB-CSE-Internship 2013

Page 12: Java

Some important concepts

Constructor

Package

Multithreading

Synchronized

This keyword

finally

Rajavel D Java IITB-CSE-Internship 2013

Page 13: Java

Any Doubts ???

Rajavel D Java IITB-CSE-Internship 2013

Page 14: Java

References

http://download.oracle.com/javase/tutorial/

http://www.tutorialspoint.com/java

www.java2s.com/Tutorial/Java/CatalogJava.h

tm

Rajavel D Java IITB-CSE-Internship 2013