Learn Java language fundamentals with Unit nexus

496 views
307 views

Published on

Learn Java with unit nexus pvt ltd with practical on live projects.

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
496
On SlideShare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
13
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Learn Java language fundamentals with Unit nexus

  1. 1. Java Language Fundamentals / 1 of 28 Java Language Fundamentals Session 2
  2. 2. Java Language Fundamentals / 2 of 28 Objectives  Interpret the Java program  Understand the basics of the Java language  Identify data types
  3. 3. Java Language Fundamentals / 3 of 28 Java Program Structure  Environment Information  Class Declaration  Tokens:  Identifiers  Keywords / Reserve words  Separators  Literals  Operators
  4. 4. Java Language Fundamentals / 4 of 28 Sample Java program
  5. 5. Java Language Fundamentals / 5 of 28 Compiling and executing the sample program
  6. 6. Java Language Fundamentals / 6 of 28 Passing Command Line Arguments (1)
  7. 7. Java Language Fundamentals / 7 of 28 Passing Command Line Arguments (2)
  8. 8. Java Language Fundamentals / 8 of 28 Basics of the Java Language  Classes & Methods  Data types  Variables  Operators  Control structures
  9. 9. Java Language Fundamentals / 9 of 28 Classes in Java  Class declaration Syntax class Classname { var_datatype variablename; : met_datatype methodname(parameter_list) : }
  10. 10. Java Language Fundamentals / 10 of 28 Sample class
  11. 11. Java Language Fundamentals / 11 of 28 Nested Classes Defining one class within another is called ‘Nesting’ Types:  Static  Non-static
  12. 12. Java Language Fundamentals / 12 of 28 Data Types  byte  char  boolean  short  int  long  float  double  Array  Class  Interface
  13. 13. Java Language Fundamentals / 13 of 28 Type Casting  One data type is converted into another data type  Example float c = 34.89675f; int b = (int)c + 10;
  14. 14. Java Language Fundamentals / 14 of 28 Variables  Three components of a variable declaration:  Data type  Name  Initial value to be assigned (optional)  Syntax datatype identifier [=value][, identifier[=value]...];
  15. 15. Java Language Fundamentals / 15 of 28 Java Reserve words
  16. 16. Java Language Fundamentals / 16 of 28 Array Declarations  Three ways for Array Declaration:  datatype identifier [ ];  datatype identifier [ ] = new datatype[size];  datatype identifier [ ]= {value1,value2,….valueN};
  17. 17. Java Language Fundamentals / 17 of 28 Methods in Classes  A method is defined as the actual implementation of an operation on an object  Syntax access_specifier modifier datatype method_name(parameter_list) { //body of method }
  18. 18. Java Language Fundamentals / 18 of 28 Sample usage of Method
  19. 19. Java Language Fundamentals / 19 of 28 Access specifiers for Methods
  20. 20. Java Language Fundamentals / 20 of 28 Method Modifiers  static  abstract  final  native  synchronized  volatile
  21. 21. Java Language Fundamentals / 21 of 28 Methods Overloading  Overloaded Methods:  Are in the same class  Have the same name  Have different parameter lists  Overloaded methods are a form of compile time polymorphism
  22. 22. Java Language Fundamentals / 22 of 28 Methods Overriding  Overridden Methods:  Are in the superclass as well as the subclass  Are redefined in the subclass  Overridden methods are a form of runtime polymorphism
  23. 23. Java Language Fundamentals / 23 of 28 Class Constructors  Special method used to initialize member variables of the class  Same name as the Class name and does not have a return type  Called when an object is created  Types:  Explicit constructors  Implicit constructors
  24. 24. Java Language Fundamentals / 24 of 28 Derived class constructors  Has the same name as the subclass  Statement that calls the constructor of the superclass should be the first statement in the constructor of a subclass
  25. 25. Java Language Fundamentals / 25 of 28 Operators Java Provides following categories of Operators:  Arithmetic Operators  Bitwise Operators  Relational Operators  Logical Operators  Conditional Operators  Assignment Operators
  26. 26. Java Language Fundamentals / 26 of 28 Operator Precedence
  27. 27. Java Language Fundamentals / 27 of 28 Escape Sequence
  28. 28. Java Language Fundamentals / 28 of 28 Control Flow  Decision – making  if-else statement  Switch-else statement  Loops  while loop  do-while loop  for loop
  29. 29. Want to contact Unit Nexus  Unit Nexus Zirakpur Official Website  Like Unit Nexus Pvt. Ltd. On Facebook  Add Unit Nexus to your professional Network on Linked In  Company Profile of Unit Nexus Java Language Fundamentals / 29 of 28

×