Basics of Java
what is Java
Basics of Java
E N D
Presentation Transcript
Objective Variable & Keyword Variable & Keyword Data Type Data Type Operators Operators Sequential Statement Sequential Statement Control Statement Control Statement Array Array 2
Data Types Data Types in Java Primitives Non-Primitive ( Derived) Numeric Non-Numeric Classes Arrays Interface Floating Point Integer Character Boolean 3
Operators in Java • Arithmetic Operators • Relational Operators • Logical Operators • Unary operators • Boolean Logical Operators • Conditional Operator 4
Comments in Java Comments in Java Start End Purpose /* */ The enclosed text is treated as a comment. // (none ) The rest of the line is treated as a comment. /** */ The enclosed text is treated as a comment by the compiler but is used by JavaDoc to automatically generate documentation. 5
Java Statements • Sequential Statements If-else Nested if-else Switch case • Control Statement do-while while for loop 6
Array in Java • Array-collection of similar data type variable. • In Java, creating an Array is nothing but creating object. • Array is “First Class Object”. • Syntax int arr[]; //declaration arr=new int[5]; //Actual Memory allocation 7
Array in Java • Way 1 int arr[]; arr=new int[5]; arr[0]=10;…… • Way 2 int arr[]={10,20,30,..}; 8
Session Summary • Variable & Keyword • Data type • Operators in Java • Sequential Statement • Control Statement • Array in Java 9