JAVA
JAVA
History
• Origin
• Father of Java Language
• Another name of Java
• Why JAVA ??
Java Environment Setup -
• Mobile applications
• Web development
• Gaming
• Industrial
• Buisness applications
• Desktop GUI applications
Advantages and Disadvantages
• Inputs - To take the value from user I.e. enter values in compiler.
• Syntax for User input -
• Import java.util.Scanner; // above the class
• Scanner input = new Scanner(System.in); // inside the function
• Keyword variable = input.nextKeyword(); // inside the function
• It converts one data type into an another data type . It is also called as Type
Conversion.
• It has 2 types -
• a. Implicit Conversion ( automatic )
• b. Explicit Conversion
Java Operators -
• Operators are symbols to perform specific task on operand or variables .
• Types of operators -
• a. Arithmetic i.e. + - * /
• b. Assignment i.e. =
• c. Relational i.e. < > <= >= == !=
• d. Logical i.e. && || !
• e. Bitwise i.e. & | ^ ~ << >>
• Special operators -
• a. Ternary/Conditional - ?:
• b. instanceof
Flow Control -
Looping -
Methods or Functions -
• Types of array -
• a. Single dimensional i.e. one dimension
• b. Multi-dimensional i.e. two , threee etc .
File handling in Java -
File operation -
• Create a file
• Read from file
• Write to file
• Get file information
• Delete the file
Wrapper Class -
• To convert Primitive datatypes into object and object into Primitive datatypes.
• It has 2 features -
• a. autoboxing
• b. Unboxing
• e.g. int c=23; i.e. Integer c=23; // so Integer is a Wrapper class
OOP ( Object – Oriented Programming )
Class, Objects and Constructor -
object - instance of class
Syntax - classname objectname = new classname();
Types -
. public
. private
. protected
. default
Types -
1. Compile time Polymorphism
2.Run-time Polymorphism
Exceptional Handling -
• The process of handling the errors is known as ' Exceptional handling.'
• Exception - error during runtime of program
• Types of exceptions -
• 1. Checked exceptions I.e. SQL and I/O exceptions
• 2. Un-checked exceptions I.e. Arithmetic and Null-pointer exceptions