java
DESCRIPTION
Java Basic presentationTRANSCRIPT
13-05-2013 Rajavel D Rajavel D
Java
Summer Internship – 2013
(Indian Institute of Technology Bombay)
Java
Object-Oriented
Platform independent
Simple
Secure
Multi-threaded
High Performance
Rajavel D Java IITB-CSE-Internship 2013
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
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
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
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
public static void main ?
java program processing starts from the main()
method.
Public ?
Static?
Void?
Rajavel D Java IITB-CSE-Internship 2013
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
Thread
Create Thread by implements Runnable interface or
extends Thread class
Rajavel D Java IITB-CSE-Internship 2013
Exception Handling
Problem that
arises during the
execution of a
program.
try{}
catch{}
finally{}
Rajavel D Java IITB-CSE-Internship 2013
Some important concepts
Constructor
Package
Multithreading
Synchronized
This keyword
finally
Rajavel D Java IITB-CSE-Internship 2013
Any Doubts ???
Rajavel D Java IITB-CSE-Internship 2013
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