The document provides an overview of key concepts in Java including:
- Java is an object-oriented, platform independent language that is simple, secure, and allows for multi-threaded, high performance applications.
- Objects have states and behaviors defined by classes. Methods define behaviors and instance variables define states.
- Programming conventions like case sensitivity, class/method naming, and file naming are important to follow.
- The main() method marks the starting point of a Java program and its modifiers and parameters are explained.
- Object-oriented principles like abstraction, encapsulation, inheritance, and polymorphism are discussed at a high-level.
- Additional concepts covered include threads, exceptions, constructors, packages, and
2. Java
Object-Oriented
Platform independent
Simple
Secure
Multi-threaded
High Performance
Rajavel D Java IITB-CSE-Internship 2013
4. 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
5. 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
6. 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
7. 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
8. public static void main ?
java program processing starts from the main()
method.
Public ?
Static?
Void?
Rajavel D Java IITB-CSE-Internship 2013
9. 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
10. Thread
Create Thread by implements Runnable interface or
extends Thread class
Rajavel D Java IITB-CSE-Internship 2013
11. Exception Handling
Problem that
arises during the
execution of a
program.
try{}
catch{}
finally{}
Rajavel D Java IITB-CSE-Internship 2013
12. Some important concepts
Constructor
Package
Multithreading
Synchronized
This keyword
finally
Rajavel D Java IITB-CSE-Internship 2013