COURSE CONTENT
SECTION-1
1.INTRODUCTION
2.HISTORY
3.JAVA S/W INSTALLATION
4.SIMPLE JAVA PROGRAMS
5.VARIABLES
6.DATA TYPES
7.CONTROL STATEMENTS
8.LOOPS
9.METHODS
10.DATA MEMBERS INITIALIZATION
SECTION-2
11. BLOCKS AND CONSTRUCTORS
12. CLASS AND OBJECT
13. SUN ARCHITECTURE
14. INTRODUCTION TO OOPS
15. INHERITANCE
16. POLYMORPHISM
17. ACCESS SPECIFIER
18. ENCAPSULATION
19. ABSTRACT AND CONCRETE
20. GENERALIZATION
21. CASTING
22. INTERFACE
23. ABSTRACT CLASS
24. SINGLTON CLASS
SECTION-3
25. JAVA LIBRARIES
26. STRING
27. ARRAY
28. EXCEPTION HANDLING
29. THREAD
30. COLLECTION FRAMEWORK
31. FILE HANDLING
32. WRAPPER CLASS
SECTION-1
1.INTRODUCTION
2.HISTORY
3.JAVA S/W INSTALLATION
4.SIMPLE JAVA PROGRAMS
5.VARIABLES
6.DATA TYPES
7.CONTROL STATEMENTS
8.LOOPS
9.METHODS
10.DATA MEMBERS INITIALIZATION
SECTION-2
11. BLOCKS AND CONSTRUCTORS
12. CLASS AND OBJECT
13. SUN ARCHITECTURE
14. INTRODUCTION TO OOPS
15. INHERITANCE
16. POLYMORPHISM
17. ACCESS SPECIFIER
18. ENCAPSULATION
19. ABSTRACT AND CONCRETE
20. GENERALIZATION
21. CASTING
22. INTERFACE
23. ABSTRACT CLASS
24. SINGLTON CLASS
SECTION-3
25. JAVA LIBRARIES
26. STRING
27. ARRAY
28. EXCEPTION HANDLING
29. THREAD
30. COLLECTION FRAMEWORK
31. FILE HANDLING
32. WRAPPER CLASS
Where java can be used?
➖JAVA program is used in, Mobile applications, Stand alone applications, dynamic applications and BigData(Hadoop) technology.
1. Standalone Applications:-
➖An application which never utilizes external resources for execution, it is known as standalone applications.
Ex: Calculators, music players, parking meters, etc
2. Dynamic Applications:-
➖An application which utilizes external resources for execution, it is known as dynamic application.
➖External resources are like server facility, internet connectivity and database utilization.
➖Dynamic applications are also also known as server side app or web applications.
Ex: Amazon, Flipkart(e-commerce) etc.
➖JAVA program is used in, Mobile applications, Stand alone applications, dynamic applications and BigData(Hadoop) technology.
1. Standalone Applications:-
➖An application which never utilizes external resources for execution, it is known as standalone applications.
Ex: Calculators, music players, parking meters, etc
2. Dynamic Applications:-
➖An application which utilizes external resources for execution, it is known as dynamic application.
➖External resources are like server facility, internet connectivity and database utilization.
➖Dynamic applications are also also known as server side app or web applications.
Ex: Amazon, Flipkart(e-commerce) etc.
JAVA Platforms:
➖Java programming language is classified into three different platforms. They are,
1. J2SE:- JAVA 2 Standard Edition
➖standalone app,
➖security high because of OOPS concept
2. J2EE:- JAVA 2 Enterprise Edition
➖dynamic app,
➖web app,
➖server side app
3. J2ME:- JAVA 2 Micro Edition
➖Java programming language is classified into three different platforms. They are,
1. J2SE:- JAVA 2 Standard Edition
➖standalone app,
➖security high because of OOPS concept
2. J2EE:- JAVA 2 Enterprise Edition
➖dynamic app,
➖web app,
➖server side app
3. J2ME:- JAVA 2 Micro Edition
*First Java Program
class Program1{
public static void main(String [] args)
{
System.out.println("Hello Java");
}
}
>output:
Hello Java
class Program1{
public static void main(String [] args)
{
System.out.println("Hello Java");
}
}
>output:
Hello Java
●Compilation:
javac FileName.java
javac Program1.java
(After compiling the java program .class will be generate)
●Execution:
java ClassName
java Program1
》output: Hello Java
javac FileName.java
javac Program1.java
(After compiling the java program .class will be generate)
●Execution:
java ClassName
java Program1
》output: Hello Java
☆JAVA class syntax:-
class ClassName
{ //class declaration
//data members~variables
// member functions~ methods
// blocks
//constructor
public static void main(String [] args)
{
//executable statement
}
}
class ClassName
{ //class declaration
//data members~variables
// member functions~ methods
// blocks
//constructor
public static void main(String [] args)
{
//executable statement
}
}
• Class name should not start with numeric or special characters.
• Class name should start with alphabet+numeric
Ex: Demo1 ✔
1_Demo ✖(which is not recommended)
• Class name should start with alphabet+numeric
Ex: Demo1 ✔
1_Demo ✖(which is not recommended)
☆Keywords:
➖Keywords are the set of predeclared words, which have its own functionality.
➖There are 52 keywords in present in Java.
➖Java is case sensitive programming language, hence all the keywords need to be declared in lower case.
➖Keywords are the set of predeclared words, which have its own functionality.
➖There are 52 keywords in present in Java.
➖Java is case sensitive programming language, hence all the keywords need to be declared in lower case.
☆Identifiers:
➖In java identifiers are used to recognise a specific area or information.
Ex:- className, method name and variable name
➖In java identifiers are used to recognise a specific area or information.
Ex:- className, method name and variable name
☆Class body:-
➖After class declaration, open in curly braces and closed curly braces represent class body.
➖In a class body, programmer can be declare data members, member functions, blocks and constructor.
➖If programmer want to declare any executable statements then those statements need to be declared inside class body.
➖Declaring executable statements outside class body throws error.
(It is because of Encapsulation rule).
➖After class declaration, open in curly braces and closed curly braces represent class body.
➖In a class body, programmer can be declare data members, member functions, blocks and constructor.
➖If programmer want to declare any executable statements then those statements need to be declared inside class body.
➖Declaring executable statements outside class body throws error.
(It is because of Encapsulation rule).
☆Main method:-
➖Main method places very important role in execution of java program because of main method is the entry point of Java program.
➖Without main method compilation takes place but execution don't.
➖Main method places very important role in execution of java program because of main method is the entry point of Java program.
➖Without main method compilation takes place but execution don't.
Ex:-
class Demo
{
public static void main(String [] args)
{
System.out.println("Hello");
}
}
javac Demo.java
java Demo
O/p:- Hello
class Demo
{
public static void main(String [] args)
{
System.out.println("Hello");
}
}
javac Demo.java
java Demo
O/p:- Hello
☆print:-
➖Prints the output and the cursor remains in the same line.
☆println:-
➖Prints the output and the cursor jumps to the next line.
➖Prints the output and the cursor remains in the same line.
☆println:-
➖Prints the output and the cursor jumps to the next line.
Ex:-
Ex:-
class Demo1
{
public static void main(String [] args)
{
System.out.print("Hello all");
System.out.println("Hello");
}
}
javac Demo1.java
java Demo
O/p:- Hello allHello
_ (cursor)
Ex:-
class Demo1
{
public static void main(String [] args)
{
System.out.print("Hello all");
System.out.println("Hello");
}
}
javac Demo1.java
java Demo
O/p:- Hello allHello
_ (cursor)
System.out.println("HI");
HI
System.out.println(2);
2
System.out.println("HI+HELLO");
HI+HELLO
System.out.println("2+2");
2+2
System.out.println(2+2);
4
System.out.println("hi"+"hello");
hihello
System.out.println("hi"+"hello"+"2+2");
hi+hello2+2
System.out.println(2+2+"hi");
4hi
System.out.println("hi"+2+2);
Hi22
System.out.println(2+2+"hi"+2+2);
4hi22
System.out.println("hi"+(2+2));
hi4
HI
System.out.println(2);
2
System.out.println("HI+HELLO");
HI+HELLO
System.out.println("2+2");
2+2
System.out.println(2+2);
4
System.out.println("hi"+"hello");
hihello
System.out.println("hi"+"hello"+"2+2");
hi+hello2+2
System.out.println(2+2+"hi");
4hi
System.out.println("hi"+2+2);
Hi22
System.out.println(2+2+"hi"+2+2);
4hi22
System.out.println("hi"+(2+2));
hi4
☆Java software installation:-
➖To deal with java programming language two software are essentials.
1. JDK
➖JDK stands for Java Development Kit, it is used to design and develop java programs.
➖Inside JDK many readymade frameworks or classes are present.
➖With the help of those readymade classes frameworks applications can be developed instantly.
➖To deal with java programming language two software are essentials.
1. JDK
➖JDK stands for Java Development Kit, it is used to design and develop java programs.
➖Inside JDK many readymade frameworks or classes are present.
➖With the help of those readymade classes frameworks applications can be developed instantly.
2. JRE
➖JRE stands for Java Runtime Environment, it is used to execute Java programs.
➖Java programming language makes use of many API(Application Programming Interface) to provide very good security for applications.
➖JRE stands for Java Runtime Environment, it is used to execute Java programs.
➖Java programming language makes use of many API(Application Programming Interface) to provide very good security for applications.
☆Configuring JDK software with OS(Operating System):-
➖After installation of JDK software visit inside below declared folder
C:\.......
➖copy the url
➖open system property window
Computer》Properties》Advanced system settings》Environment variables》system variables》PATH》PASTE THAT URL.
➖It pop-up window appears on the screen, the already some information will be predeclared. Don't manipulate that information, after information tyle ';' and paste the jdk url
➖Open the command prompt and type Java, a list of predeclared commands related to java appears on the screen. If not then crosscheck with configuration steps.
➖After installation of JDK software visit inside below declared folder
C:\.......
➖copy the url
➖open system property window
Computer》Properties》Advanced system settings》Environment variables》system variables》PATH》PASTE THAT URL.
➖It pop-up window appears on the screen, the already some information will be predeclared. Don't manipulate that information, after information tyle ';' and paste the jdk url
➖Open the command prompt and type Java, a list of predeclared commands related to java appears on the screen. If not then crosscheck with configuration steps.
☆Java program Execution flow:-
➖Java program execution flow involves three steps process, they are
1. Coding
2. Compilation
3. Execution
➖Java program execution flow involves three steps process, they are
1. Coding
2. Compilation
3. Execution